<template>
<!-- 出纳工作台 -->
<section class="content-box">
  <div>
  <!--工具条-->
  <div v-if="isshowList">
    <!--工具条-->
    <el-col :span="24" class="toolbar">
      <el-form class="title cover">
        <h2>{{state==1?'收款':state==2?'付款':''}}工作台</h2>
        <el-form-item>
          <!-- <el-button @click="handleAdd" class="el-icon-plus" size="small">&nbsp;新建{{state==1?'收款单':state==2?'付款单':''}}&nbsp;</el-button> -->
          <el-button @click="handleAdd" class="el-icon-plus" size="small">&nbsp;新建&nbsp;</el-button>
        </el-form-item>
        <el-form-item>
          <el-button size="small" @click="search" class="el-icon-search">&nbsp;查询</el-button>
        </el-form-item>
      </el-form>
    </el-col>
    <!-- <el-col :span="24" class="SuppC-toolbar">
      <el-form class="title">
        <div>
          <h2>{{state==1?'收款':state==2?'付款':''}}工作台</h2>
          <img @click="handleAdd" class="SuppC-common-icon" src="../../../static/content/images/Common/common-add.png" alt=""/>
        </div>
        <el-form-item class="cover">
          <div class="list-img" @click="search">
            <img class="SuppC-common-icon" src="../../../static/content/images/Common/common-query.png" alt=""/>
            <span>查询</span>
          </div>
        </el-form-item>
      </el-form>
    </el-col> -->
    <!-- 列表 -->
    <!-- <el-table class="indexList" v-if="workList" :data="workList" highlight-current-row v-loading="loading" element-loading-text="正在加载中">
      <el-table-column label="序号" type="index" width="100" sortable>
      </el-table-column>
      <el-table-column prop="DocType" label="业务类型">
      </el-table-column>
      <el-table-column prop="DocNO" label="单据编号" sortable>
      </el-table-column>
      <el-table-column prop="DocDate" label="单据日期" :formatter="formatDate" sortable>
      </el-table-column>
      <el-table-column prop="Title" label="标题" show-overflow-tooltip>
      </el-table-column>
      <el-table-column prop="DocStatus" label="单据状态">
      </el-table-column>
      <el-table-column prop="TotalMoney" label="金额">
      </el-table-column>
      <el-table-column label="操作" min-width="200">
        <template slot-scope="scope">
          <el-button-group>
            <el-button size="small" @click="handling(scope.$index, scope.row)">处理</el-button>         
            <el-button size="small" @click="revoToEdit(scope.$index, scope.row)">撤销到提交者修改</el-button>
            <el-button size="small" @click="revoToNews(scope.$index, scope.row)">撤销为新建</el-button>
          </el-button-group>
        </template>
      </el-table-column>
    </el-table> -->
    <el-table class="indexList" v-if="workList" :data="workList" @row-dblclick="handling" @cell-mouse-enter="cellMouseEnterTwoFn" @cell-mouse-leave="cellMouseLeaveFn" highlight-current-row v-loading="loading" element-loading-text="正在加载中" style="100%">
      <el-table-column prop="DocDate" label="日期" :formatter="formatDate" sortable>
      </el-table-column>
      <el-table-column prop="DocNO" label="单号" sortable>
      </el-table-column>
      <el-table-column prop="DocType" label="业务类型">
      </el-table-column>
      <el-table-column prop="TotalMoney" label="金额">
      </el-table-column>
      <el-table-column prop="Title" label="业务描述" min-width="150" show-overflow-tooltip>
      </el-table-column>
      <el-table-column prop="DocStatus" label="状态">
      </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <!-- <el-button-group>
            <el-button size="small" @click="handling(scope.$index, scope.row)">处理</el-button>         
            <el-button size="small" @click="revoToEdit(scope.$index, scope.row)">撤销到提交者修改</el-button>
            <el-button size="small" @click="revoToNews(scope.$index, scope.row)">撤销为新建</el-button>
          </el-button-group> -->
          <div v-if="scope.row.DocNO==mouse_enter_Rcv_DocNO">
          <!-- <div>  -->
            <div class="list-img" @click.stop="revoToChange(scope.row)">
              <!-- 撤销到提交者修改 -->
              <img class="common-icon" src="../../../static/content/images/Common/common-repeal.png" alt=""/>
            </div>
          </div>
        </template>
      </el-table-column>
    </el-table>
    <!--工具条-->
		<el-col :span="24" class="toolbar">
		<el-pagination @current-change="changePage" layout="prev, pager, next" :page-size="rows" :current-page="currentPage" :total="total" style="float:right;">
		</el-pagination>
		</el-col>
    <!-- 新建页面 -->
  </div>
    <!--还款-->
    <el-dialog title="处理" :visible.sync="dialogRefundVisible" :modal-append-to-body="false" size="small">                                                
        <h2 class="titles">《{{RefundMoneyObj.ER_Tite}}》<span>{{state===1?'收款单':'付款单'}}</span>
          <el-button v-if="isShowPrint==true" @click="getRefundHandlePrint" size="small" class="printClass">&nbsp;处理打印&nbsp;</el-button>                                                                                  
          <el-button v-if="isShowPrint==true" @click="getRefundPrint" size="small" class="printClass">&nbsp;流程打印&nbsp;</el-button> 
        </h2>
        <div>&#12288;</div>
        <div class="rows">      
            <span class="labels">类型：</span><el-input size="small" type="input" v-model="RefundMoneyObj.ER_Tite" auto-complete="off" class="wInput" :disabled="true"></el-input>
            <span class="labels">制单日期：</span><el-date-picker size="small" type="date" v-model="RefundMoneyObj.dt[0].Repay_DocDate" placeholder="选择日期" class="wDate"></el-date-picker>                                             
        </div>
        <div class="rows"> 
            <span class="labels">单号：</span><el-input size="small" type="input" v-model="RefundMoneyObj.dt[0].Repay_DocNO" auto-complete="off" class="wInput" :disabled="true"></el-input>                                                                                              
            <span class="labels">收款方式：</span><el-select size="small" filterable v-model="RefundMoneyObj.dt[0].Repay_RcvAccountItem" placeholder="请选择" class="wSelect">
              <el-option
                v-for="(item,index) in ReceivingTypeList"
                :key="index"
                :label="item.AccountItem_Name"
                :value="item.AccountItem_Code">
              </el-option>
            </el-select>
        </div>
        <div class="rows"> 
            <span class="labels">状态：</span><el-input size="small" type="input" v-model="RefundMoneyObj.dt[0].DocStatus" auto-complete="off" class="wInput" :disabled="true"></el-input>
            <span class="labels">申请人：</span><el-input size="small" type="input" v-model="RefundMoneyObj.dt[0].UserName" auto-complete="off" class="wInput" :disabled="true"></el-input>
        </div>
        <div class="rows"> 
            <span class="labels">现金流量类型：</span><el-select size="small" v-model="RefundMoneyObj.dt[0].Repay_CashFlowItem" placeholder="请选择" class="wSelect" :disabled="true">
              <el-option
                v-for="(item,index) in CashFlowList"
                :key="index"
                :label="item.CashFlowItem_Name"
                :value="item.CashFlowItem_Code">
              </el-option>
            </el-select>
            <span class="labels">申请部门：</span><el-input size="small" v-model="RefundMoneyObj.dt[0].Dept_Name" auto-complete="off" class="wInput" :disabled="true"></el-input>
        </div>
        <div class="rows"> 
            <span class="labels">现金期间：</span><el-select size="small" v-model="RefundMoneyObj.dt[0].Repay_CashPeriod" placeholder="请选择" class="wSelect">
              <el-option
                v-for="(item,index) in PeriodList"
                :key="index"
                :label="item.Period_Name"
                :value="item.Period_Code">
              </el-option>
            </el-select>
            <span class="labels">标题：</span><el-input size="small" v-model="RefundMoneyObj.dt[0].Repay_Title" auto-complete="off" class="wInput" :disabled="true"></el-input>                                                                                     
        </div>
        <div class="rows"> 
            <span class="labels">还款金额合计：</span><el-input size="small" v-model="RefundMoneyObj.dt[0].Repayment" auto-complete="off" class="wInput" :disabled="true"></el-input>               
            <span class="labels">权责期间：</span><el-input size="small" v-model="RefundMoneyObj.dt[0].Repay_AccountPeriod" auto-complete="off" class="wInput" :disabled="true"></el-input>                                                     
        </div>
        <div slot="footer" class="dialog-footer">
            <el-button @click="cancel">取 消</el-button>
            <el-button type="primary" v-if="isShowPrint==false" @click="handlingDetermine">确 定</el-button>
        </div>
    </el-dialog>
    <!--借款-->
    <el-dialog title="处理" :visible.sync="dialogBusinessVisible" :modal-append-to-body="false" size="small">                                      
            <h2 class="titles">《{{BusinessObj.ER_Tite}}》<span>{{state===1?'收款单':'付款单'}}</span>
              <el-button v-if="isShowPrint==true" @click="getBorrowHandlePrint" size="small" class="printClass">&nbsp;处理打印&nbsp;</el-button>                                                        
              <el-button v-if="isShowPrint==true" @click="getBorrowPrint" size="small" class="printClass">&nbsp;流程打印&nbsp;</el-button>
            </h2>   
            <div>&#12288;</div>                            
            <div class="rows">                               
              <span class="labels">单据日期：</span><el-date-picker type="date" v-model="BusinessObj.dt[0].Borrow_DocDate" placeholder="选择日期" class="wDate"></el-date-picker>
              <span class="labels">业务类型：</span><el-input type="input" v-model="BusinessObj.dt[0].BusinessTypeName" auto-complete="off" class="wInput" :disabled="true"></el-input>
            </div>              
            <div class="rows">   
              <span class="labels">供应商名称：</span><el-input type="input" v-model="BusinessObj.dt[0].Name" auto-complete="off" class="wInput" :disabled="true"></el-input>
              <span class="labels">借款金额合计：</span><el-input type="input" v-model="BusinessObj.dt[0].Borrow_TotalBorrowMoney" auto-complete="off" class="wInput" :disabled="true"></el-input>
            </div>                             
            <div class="rows">   
              <span class="labels">付款方式</span><el-select v-model="BusinessObj.dt[0].Borrow_PayAccountItem" placeholder="请选择" class="wSelect">
                <el-option
                  v-for="(item,index) in ReceivingTypeList"
                  :key="index"
                  :label="item.AccountItem_Name"
                  :value="item.AccountItem_Code">
                </el-option>
              </el-select>
              <span class="labels">收款银行</span><el-select v-model="BusinessObj.dt[0].bank" placeholder="请选择" class="wSelect">
                <el-option
                  v-for="(item,index) in bankList"
                  :key="index"
                  :label="item.Bank"
                  :value="item.Code">
                </el-option>
              </el-select>
            </div>
            <div class="rows">   
              <span class="labels">银行账号：</span><el-input type="input" v-model="BusinessObj.dt[0].bankAccount" auto-complete="off" class="wInput" :disabled="true"></el-input>
              <span class="labels">现金期间：</span><el-select v-model="BusinessObj.dt[0].Borrow_CashPeriod" placeholder="请选择" class="wSelect">
                <el-option
                  v-for="(item,index) in PeriodList"
                  :key="index"
                  :label="item.Period_Name"
                  :value="item.Period_Code">
                </el-option>
              </el-select>
            </div>
            <div class="rows">   
                <span class="labels">类型：</span><el-input type="input" v-model="BusinessObj.ER_Tite" auto-complete="off" class="wInput" :disabled="true"></el-input>
                <span class="labels">用途：</span><el-input type="input" v-model="BusinessObj.dt[0].Borrow_Title" auto-complete="off" class="wInput" :disabled="true"></el-input>
            </div>
            <div class="rows">
                <span class="labels">单号：</span><el-input type="input" v-model="BusinessObj.dt[0].Borrow_DocNO" class="wInput" :disabled="true"></el-input>
                <span class="labels">审核</span><el-input type="input" v-model="BusinessObj.dt[0].Borrow_BusinessType"  :disabled="true" class="wInput"></el-input>
            </div>
            <div class="rows">
                <span class="labels">状态：</span><el-input type="input" v-model="BusinessObj.dt[0].DocStatus"  :disabled="true" class="wInput"></el-input>
                <span class="labels">权责期间</span><el-input type="input" v-model="BusinessObj.dt[0].Borrow_AccountPeriod"   :disabled="true" class="wInput"></el-input>
            </div>
            <div class="rows">                            
                <span class="labels">申请人：</span><el-input type="input" v-model="BusinessObj.dt[0].UserName" :disabled="true" class="wInput"></el-input>                                
                <span class="labels">申请部门</span><el-input type="input" v-model="BusinessObj.dt[0].Dept_Name"  :disabled="true" class="wInput"></el-input>
            </div>
            <div class="rows"> 
                <span class="labels">现金流量类型：</span>
                <el-select v-model="BusinessObj.dt[0].Borrow_CashFlowItem" placeholder="请选择"  :disabled="true" class="wSelect">
                  <el-option
                    v-for="(item,index) in CashFlowList"
                    :key="index"
                    :label="item.CashFlowItem_Name"
                    :value="item.CashFlowItem_Code">
                  </el-option>
                </el-select>
                <span class="labels">标题：</span><el-input type="input" v-model="BusinessObj.dt[0].Borrow_Title"  :disabled="true" class="wInput"></el-input>
            </div>
        <div slot="footer" class="dialog-footer">
            <el-button @click="cancel">取 消</el-button>
            <el-button type="primary" v-if="isShowPrint==false" @click="handlingDetermine">确 定</el-button>
        </div>
    </el-dialog>
    <!--报销-->
    <el-dialog title="处理" :visible.sync="dialogExpenseVisible" :modal-append-to-body="false" size="small">                                                
                        <h2 class="titles">《{{ExpenseObj.ER_Tite}}》<span>{{state===1?'收款单':'付款单'}}</span>
                          <el-button v-if="isShowPrint==true" @click="getExpenseHandlePrint" size="small" class="printClass">&nbsp;处理打印&nbsp;</el-button>                          
                          <el-button v-if="isShowPrint==true" @click="getExpensePrint" size="small" class="printClass">&nbsp;流程打印&nbsp;</el-button>
                        </h2>
                        <div>&#12288;</div>
                        <div class="rows">      
                          <span class="labels">单据日期：</span><el-date-picker size="small" type="date" v-model="ExpenseObj.dt[0].Expense_DocDate" placeholder="选择日期" class="wDate"></el-date-picker>                                             
                          <span class="labels">业务类型：</span><el-input size="small" type="input" v-model="ExpenseObj.dt[0].BusinessTypeName" auto-complete="off" class="wInput" :disabled="true"></el-input>                         
                        </div>
                        <div class="rows"> 
                          <span class="labels">供应商：</span><el-input size="small" type="input" v-model="ExpenseObj.dt[0].Name" auto-complete="off" class="wInput" :disabled="true"></el-input>                                                                                              
                          <span class="labels">本次报销金额：</span><el-input size="small" type="input" v-model="ExpenseObj.dt[0].Expense_TotalRequestMoney" auto-complete="off" class="wInput" :disabled="true"></el-input>                                                                                              
                        </div>
                        <div class="rows"> 
                          <span class="labels">本次核销借款：</span><el-input size="small" type="input" v-model="ExpenseObj.dt[0].Repayment" auto-complete="off" class="wInput" :disabled="true"></el-input>
                          <span class="labels">本次付款金额：</span><el-input size="small" type="input" v-model="ExpenseObj.dt[0].Payment" auto-complete="off" class="wInput" :disabled="true"></el-input>
                        </div>
                        <div class="rows"> 
                            <span class="labels">付款方式：</span><el-select size="small" v-model="ExpenseObj.dt[0].Expense_PayAccountItem" placeholder="请选择" class="wSelect">
                                <el-option
                                  v-for="(item,index) in ReceivingTypeList"
                                  :key="index"
                                  :label="item.AccountItem_Name"
                                  :value="item.AccountItem_Code">
                                </el-option>
                            </el-select>
                            <span class="labels">收款银行：</span><el-select size="small" v-model="ExpenseObj.dt[0].bank" placeholder="请选择" class="wSelect">
                                <el-option
                                  v-for="(item,index) in bankList"
                                  :key="index"
                                  :label="item.Bank"
                                  :value="item.Code">
                                </el-option>
                            </el-select>
                        </div>
                        <div class="rows">                                       
                            <span class="labels">银行账号：</span><el-input size="small" v-model="ExpenseObj.dt[0].bankAccount" auto-complete="off" class="wInput" :disabled="true"></el-input>
                            <span class="labels">现金期间：</span><el-select size="small" v-model="ExpenseObj.dt[0].Expense_CashPeriod" placeholder="请选择" class="wSelect">
                                <el-option
                                  v-for="(item,index) in PeriodList"
                                  :key="index"
                                  :label="item.Period_Name"
                                  :value="item.Period_Code">
                                </el-option>
                            </el-select>
                        </div>
                        <div class="rows">                                                    
                            <span class="labels">类型：</span><el-input size="small" v-model="ExpenseObj.ER_Tite" auto-complete="off" class="wInput" :disabled="true"></el-input>                                                                                     
                            <span class="labels">用途：</span><el-input size="small" v-model="ExpenseObj.dt[0].Expense_Title" auto-complete="off" class="wInput" :disabled="true"></el-input>               
                        </div>
                        <div class="rows"> 
                            <span class="labels">单号：</span><el-input size="small" v-model="ExpenseObj.dt[0].Expense_DocNO" auto-complete="off" class="wInput" :disabled="true"></el-input>                                                     
                            <span class="labels">状态：</span><el-input size="small" v-model="ExpenseObj.dt[0].DocStatus" auto-complete="off" class="wInput" :disabled="true"></el-input>                                                                                 
                        </div>
                        <div class="rows"> 
                            <span class="labels">权责期间：</span><el-input size="small" v-model="ExpenseObj.dt[0].Expense_AccountPeriod" auto-complete="off" class="wInput" :disabled="true"></el-input>                                                     
                            <span class="labels">申请人：</span><el-input size="small" v-model="ExpenseObj.dt[0].UserName" auto-complete="off" class="wInput" :disabled="true"></el-input>                                                                                 
                        </div>
                        <div class="rows">
                            <span class="labels">现金流量类型：</span><el-select v-model="ExpenseObj.dt[0].Expense_CashFlowItem" placeholder="请选择" class="wSelect">
                            <el-option
                                v-for="(item,index) in CashFlowList"
                                :key="index"
                                :label="item.CashFlowItem_Name"
                                :value="item.CashFlowItem_Code">
                                </el-option>
                            </el-select>   
                            <span class="labels">申请部门：</span><el-input size="small" v-model="ExpenseObj.dt[0].Dept_Name" auto-complete="off" class="wInput" :disabled="true"></el-input>                                                                                      
                        </div>
                        <div class="rows">
                            <span class="labels">标题</span><el-input size="small" v-model="ExpenseObj.dt[0].Expense_Title" auto-complete="off" class="wInput" :disabled="true"></el-input>                            
                        </div>
                        <div slot="footer" class="dialog-footer">
                            <el-button @click="cancel">取 消</el-button>
                            <el-button type="primary" v-if="isShowPrint==false" @click="handlingDetermine">确 定</el-button>
                        </div>
                    </el-dialog>
    <div v-if="isshowAddRcv">
      <!-- 导航条 -->
			<div class="flex-top">
				<div>
					<i class="el-icon-arrow-left back" @click="addToBack"></i>
					<span style="font-size:20px;vertical-align:middle;margin:0 10px;">
						出纳{{state==1?'收款单':state==2?'付款单':''}} </span>
					<!-- <small>
						<span>状态：</span>
						<el-tag type="success">新增</el-tag>
					</small> -->
				</div>
        <!-- 右侧 -->
				<div class="flex">
					<span class="wrapper cover">
            <el-button-group>
              <el-button size="small" @click="openUploadDialog">
                <i class="icon iconfont icon-shangchuan"></i>&nbsp;附件
              </el-button>
              <el-button size="small" @click="addRcvSave">
                <i class="icon iconfont icon-baocun"></i>&nbsp;保存
              </el-button>
              <el-button size="small" @click="addRcvSubmit">
                <i class="icon iconfont icon-tijiao"></i>&nbsp;提交
              </el-button>
            </el-button-group>
					</span>
				</div>
      </div>
      <div class="flex-content">
      <!-- 中部 -->
        <main class="Work main">
          <div class="main-left">
            <div v-if="DocNo">					
              <h3>单号:</h3>
              <strong>{{DocNo}}</strong>
            </div>
            <div>
              <h3>日期：</h3>
              <div class="flex">
                <el-date-picker type="date" v-model="docDate" placeholder="选择日期">
                </el-date-picker>
              </div>
            </div>
            <div>
              <h3>收款金额：</h3>
              <div class="flex">
                <el-input type="text" @blur="doToFixedFn('CollectionMoney')" @keyup.native="onlyNumBasicFn('CollectionMoney')" v-model="CollectionMoney"></el-input>
              </div>
            </div>
          </div>
          <div class="main-right">
            <div class="line-heigth-80" style="width: 100%;">
              <el-row>
                <!-- <el-col :span="12">
                  <span class="rvc">现金期间</span>
                  <el-select class="ele-select" v-model="period"  placeholder="请选择" filterable>
                    <el-option
                      v-for="item in PeriodList"
                      :key="item.ID"
                      :label="item.Period_Name"
                      :value="item.Period_Code">
                    </el-option>
                  </el-select>
                </el-col>
                <el-col :span="12">
                  <span class="rvc">客户</span>
                  <el-tooltip content="请您输入客户名称快捷查询" placement="top">
                    <el-select 
                    class="ele-select" 
                    v-model="custom"  
                    placeholder="请输入关键字" 
                    :remote-method="remoteMethod"
                    remote
                    filterable 
                    @change="changeCustom(custom)"
                    clearable>
                      <el-option 
                        v-for="item in Customer" 
                        :key="item.Code" 
                        :value='item.Code' 
                        :label="item.Name">
                      </el-option>
                    </el-select>
                  </el-tooltip>
                </el-col>
                <el-col :span="12">
                  <span class="rvc">收款方式</span>
                  <el-select class="ele-select" v-model="receivingType"  placeholder="请选择" filterable>
                    <el-option v-for="(r,index) in ReceivingTypeList" 
                    :key="index" 
                    :value="r.AccountItem_Code" 
                    :label="r.AccountItem_Name">
                    </el-option>
                  </el-select>
                </el-col>
                <el-col :span="12">
                  <span class="rvc">收款金额</span>
                  <input type="text" class='applied' v-model="CollectionMoney">
                </el-col> -->
                <el-col :span="12">
                  <div>
                    <span class="rvc ele-text text-money text-right">客&emsp;&emsp;户</span>
                    <el-tooltip class="margin-left-20" content="请您输入客户名称快捷查询" placement="top">
                      <el-select 
                      class="ele-select" 
                      v-model="custom"  
                      placeholder="请输入关键字" 
                      :remote-method="remoteMethod"
                      remote
                      filterable 
                      @change="changeCustom(custom)"
                      clearable>
                        <el-option 
                          v-for="item in Customer" 
                          :key="item.AI_Code" 
                          :value='item.AI_Code' 
                          :label="item.AI_Name">
                        </el-option>
                      </el-select>
                    </el-tooltip>                    
                  </div>
                  <div>
                    <span class="rvc ele-text text-money text-right">现金期间</span>
                    <el-select class="ele-select margin-left-20" v-model="period"  placeholder="请选择" filterable>
                      <el-option
                        v-for="item in PeriodList"
                        :key="item.ID"
                        :label="item.Period_Name"
                        :value="item.Period_Code">
                      </el-option>
                    </el-select>                    
                  </div>
                  <div>
                    <span class="rvc ele-text text-money text-right">收款方式</span>
                    <el-select class="ele-select margin-left-20" v-model="receivingType"  placeholder="请选择" filterable>
                      <el-option v-for="(r,index) in ReceivingTypeList" 
                      :key="index" 
                      :value="r.AccountItem_Code" 
                      :label="r.AccountItem_Name">
                      </el-option>
                    </el-select>                    
                  </div>
                </el-col>
                <el-col :span="12">
                  <span>业务描述</span>
                  <el-input
                    class="input-resize-none"
                    type="textarea"
                    :rows="6"
                    placeholder="请输入内容"
                    v-model="describe">
                  </el-input>
                </el-col>
              </el-row>
            </div>
            <div class="right-form">
              <!-- <span>业务描述</span><br><br>
              <el-input
                type="textarea"
                :rows="10"
                placeholder="请输入内容"
                v-model="describe">
              </el-input> -->
            </div>
          </div>
        </main>
        <!--底部-->
        <div class="budget-two">
          <div class="nav">
            <el-switch 
            v-model="isSwitch" 
            @change="showChange(isSwitch)"
            on-color="#13ce66"
            off-color="#ff4949"></el-switch>&#12288;是否预收款
            <div v-if="isShowPayment">
              <!-- 合计：<span class="Count">{{Count1}}</span>&#12288;        
              <el-button size="small" class="add-button"  @click="getPaymentAddDiaLog">选择收入确认</el-button> -->
              <el-dialog title="选择收入确认" :visible.sync="dialogPayVisible" @close="doCloseFn" :modal-append-to-body="false" align="center" size="small">
                <el-table :data="paymentsTemp" border  highlight-current-row max-height="300" class="th-text-center">
                  <el-table-column label="单号">
                    <template slot-scope="scope">
                    {{ scope.row.Income_DocNo }}
                    </template>
                  </el-table-column>
                  <el-table-column label="金额">
                    <template slot-scope="scope">
                    {{ scope.row.Income_TotalIncomeMoney==0 ? '' : scope.row.Income_TotalIncomeMoney}}
                    </template>
                  </el-table-column>
                  <el-table-column label="未收款金额">
                    <template slot-scope="scope">
                    {{ scope.row.Surplus==0 ? '' : scope.row.Surplus}}
                    </template>
                  </el-table-column>
                  <el-table-column label="本次收款金额">
                    <template slot-scope="scope">
                      <div class="full-box">
                        <el-input :autofocus="true" type="text" @keyup.native="onlyNumObjFn(scope,'row','Money')" @blur="doToFixed(scope,'row','Money')" v-model="scope.row.Money" placeholder="请输入金额">
                        </el-input>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column label="摘要">
                    <template slot-scope="scope">
                    {{ scope.row.Income_Title }}
                    </template>
                  </el-table-column>
                </el-table>
                <span slot="footer" class="dialog-footer">
                  <el-button @click="doCloseFn">取 消</el-button>
                  <el-button type="primary" @click="confirm">确 定</el-button>
                </span>
              </el-dialog>
              <div v-if="paymentsPrint" class="padding-top-10">
                <div class="nav">
                  <span><i class="icon iconfont icon-iconfontcolor52"></i>收款明细</span>
                </div>                 
                <el-table :data="paymentsPrint" @click.native="getPaymentAddDiaLog" @cell-mouse-enter="cellMouseEnterFn" @cell-mouse-leave="cellMouseLeaveFn" :empty-text="'点击--修改收入明细'" border style="width: 100%;" highlight-current-row max-height="300" class="th-text-center">
                  <el-table-column label="操作" width="80">
                    <template slot-scope="scope">
                      <div class="text-align-center" v-if="scope.row.Rcv_DocNO==mouse_enter_Rcv_DocNO">
                        <button size="small" class="oper-btn" @click.stop="changeMoneyToZero(scope)"><img class="common-icon" src="/static/content/images/Common/common-dele.png"/></button>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column label="单号" width="120">
                    <template slot-scope="scope">
                    {{ scope.row.Income_DocNo }}
                    </template>
                  </el-table-column>
                  <el-table-column label="金额" width="120">
                    <template slot-scope="scope">
                    {{ scope.row.Income_TotalIncomeMoney==0 ? '' : scope.row.Income_TotalIncomeMoney}}
                    </template>
                  </el-table-column>
                  <el-table-column label="未收款金额" width="120">
                    <template slot-scope="scope">
                    {{ scope.row.Surplus==0 ? '' : scope.row.Surplus}}
                    </template>
                  </el-table-column>
                  <el-table-column label="本次收款金额" width="150">
                    <template slot-scope="scope">
                    {{ scope.row.Money==0 ? '' : scope.row.Money}}
                    </template>
                  </el-table-column>
                  <el-table-column label="摘要">
                    <template slot-scope="scope">
                    {{ scope.row.Income_Title }}
                    </template>
                  </el-table-column>
                </el-table>
                <div class="clearfloat">
                  <div class="total-box">合计：<span class="Count-text">{{Count1}}</span></div>
                </div>              
              </div>
            </div>
          </div>
          <div v-if="isAdvanceDetails" class="padding-size-10">
            <!-- <div style="margin-left:10px;" class="cover">     
              <el-button size="small" @click="addlist" style="margin-left:10px;">添加预算明细</el-button>
            </div> -->
            <div class="nav">
              <span><i class="icon iconfont icon-iconfontcolor52"></i>预收明细</span>
            </div>               
            <table class="cusTable" border="1" width="100%">
              <tr>
                <th>操作</th>
                <th>部门</th>
                <th>收入类型</th>
                <th>金额</th>
              </tr>
              <tr v-for="(i,index) in detail" :key="index" class="cusTable-tr">
                <!-- 遍历初始化的detail添加行空数据 -->
                <td width="10%">
                  <!-- <el-button size="small" @click="RvcDelete(index)" type="danger" class="dele">删除</el-button> -->
                  <div class="oper-btn-wrapper">
                    <button size="small" @click.stop="RvcDelete(index)" class="oper-btn"><img class="common-icon" src="/static/content/images/Common/common-dele.png"/></button>
                    <button size="small" @click.stop="addlist" class="oper-btn"><img class="common-icon" src="/static/content/images/Common/common-add.png"/></button>
                  </div>                     
                </td>
                <td width="35%">      
                  <el-select class="formVal full-box" v-model="i.Department">
                    <!-- v-model => 部门 -->
                    <el-option v-for="(item,index) in baseDeptList" :value="item.CODE" :key="index" :label="item.FULLNAME">
                    </el-option>
                  </el-select>
                </td>
                <td width="35%">
                  <el-select class="formVal full-box" v-model="i.BudgetItem">   
                    <!-- v-model => 类型 -->
                    <el-option v-for="(item,index) in budgetItemList" :value="item.BudgetItem_Code" :key="index" :label="item.BudgetItem_FullName">
                    </el-option>
                  </el-select>
                </td>
                <td>
                  <el-input type="text"@blur="doToFixed(i,'IncomeMoney')" @keyup.native="onlyNumObjFn(i,'IncomeMoney')" @keydown.enter.native="addlist" v-model="i.IncomeMoney" :placeholder="'请输入金额'" class="formval-money full-box"></el-input>
                  <!-- v-model => 金额 -->
                </td>
              </tr>
            </table>
            <div class="clearfloat">
              <div class="total-box">合计：<span class="Count-text">{{Count3}}</span></div>
            </div>             
          </div>
        </div>
      </div>
    </div>
    <div v-if="isshowAddPay">
      <!--导航条-->
      <div class="flex-top">
        <div>
					<i class="el-icon-arrow-left back" @click="addToBack"></i>
					<span style="font-size:20px;vertical-align:middle;margin:0 10px;">
						出纳{{state==1?'收款单':state==2?'付款单':''}} </span>
					<!-- <small>
						<span>状态：</span>
						<el-tag type="success">新增</el-tag>
					</small> -->
				</div>
        <!-- 右侧 -->
				<div class="flex">
					<span class="wrapper cover">
            <el-button-group>
              <el-button size="small"  @click="openUploadDialog">
                <i class="icon iconfont icon-shangchuan"></i>&nbsp;附件
              </el-button>
              <el-button size="small"  @click="addPaySave">
                <i class="icon iconfont icon-baocun"></i>&nbsp;保存
              </el-button>
              <el-button size="small"  @click="addPaySubmit">
                <i class="icon iconfont icon-tijiao"></i>&nbsp;提交
              </el-button>
            </el-button-group>
					</span>
				</div>
      </div>
      <div class="flex-content">
        <!-- 中部 -->
        <main class="Work main" style="height: auto !important;">
          <div class="main-left">
            <div>
              <h3>日期：</h3>
              <div class="flex">
                <el-date-picker type="date" v-model="docDate" placeholder="选择日期">
                </el-date-picker>
              </div>
            </div>
            <div>
              <h3>申请金额：</h3>
              <div class="flex">
                <el-input type="text" @blur="doToFixedFn('applyMoney')" @keyup.native="onlyNumBasicFn('applyMoney')" v-model="applyMoney"></el-input>
              </div>
            </div>
          </div>
          <div class="main-right">
              <div class="left-form" style="line-height: 60px !important;">
                <el-row>
                  <el-col :span="12">
                  <span class="pay">收款对方</span>
                    <el-select  class="ele-select" v-model="supplier"  placeholder="请选择" filterable  @change="choiceSupplie(supplier)">
                      <el-option
                        v-for="(item,index) in SupplierList"
                        :key="index"
                        :label="item.Name"
                        :value="item.Code">
                      </el-option>
                    </el-select>
                  </el-col>
                  <el-col :span="12">
                  <span class="pay">开户银行</span>
                  <el-select  class="ele-select" v-model="bank"  placeholder="请选择" filterable>
                    <el-option 
                      v-for="(item,index) in bankList" 
                      :key="index" 
                      :value="item.Code"
                      :label="item.Bank">
                    </el-option>
                    </el-select>
                  </el-col>
                  <el-col :span="12">
                    <span class="pay">现金流量</span>
                    <el-select class="ele-select" v-model="cashFlow"  placeholder="请选择" filterable>
                      <el-option v-for="(r,index) in CashFlowList" 
                      :key="index" 
                      :value="r.CashFlowItem_Code" 
                      :label="r.CashFlowItem_Name">
                      </el-option>
                    </el-select>
                  </el-col>
                  <el-col :span="12">
                    <span class="pay">付款方式</span>
                    <el-select class="ele-select" v-model="receivingType"  placeholder="请选择" filterable>
                      <el-option v-for="(r,index) in ReceivingTypeList" 
                      :key="index" 
                      :value="r.AccountItem_Code" 
                      :label="r.AccountItem_Name">
                      </el-option>
                    </el-select>
                  </el-col>
                  <el-col :span="12">
                    <span class="pay">现金期间</span>
                    <el-select class="ele-select" v-model="period"  placeholder="请选择" filterable>
                      <el-option v-for="(item,index) in PeriodList" 
                      :key="index" 
                      :value="item.Period_Code" 
                      :label="item.Period_Name">
                      </el-option>
                    </el-select>
                  </el-col>
                  <el-col :span="12" style="position:relative">
                    <span class="pay">银行账号</span>
                    <!-- <el-tag v-if="bankAccount" type="primary" class="bankNum">{{bankAccount}}</el-tag>-->
                    <span v-if="bankAccount" type="primary" class="bankNum">
                      {{bankAccount}}
                    </span>
                  </el-col>
                  <!-- <el-col :span="24">
                    <span class="pay">申请金额</span>
                    <input type="text" class='applied' v-model="applyMoney">
                  </el-col> -->
                  <el-col :span="24">
                    <span class="pay">业务描述</span>
                    <div style="display: inline-block;width: 75%;">
                      <el-input
                        type="textarea"
                        :rows="2"
                        placeholder="请输入内容"
                        v-model="describe">
                      </el-input>
                    </div>                  
                  </el-col>
                </el-row>
            </div>
            <div class="right-form">
              <!-- <span>业务描述</span><br><br>
              <el-input
                type="textarea"
                :rows="10"
                placeholder="请输入内容"
                v-model="describe">
              </el-input> -->
            </div>
          </div>
        </main>
        <!--底部-->
        <div class="budget-two">
          <div class="padding-size-10">
            <div class="nav">
              <!-- 合计：<span class="Count">{{Count2}}</span>&#12288; -->
              <span><i class="icon iconfont icon-iconfontcolor52"></i> 付款明细</span>
              <!-- <el-button class="add-button" size="small" @click="addBudgetlist">添加行</el-button> -->
            </div>
            <table class="cusTable" border="1" width="100%">
              <tr>
                <th>操作</th>
                <th>对方科目</th>
                <th>辅助核算项目</th>
                <th>金额</th>
              </tr>
              <tr v-for="(i,index) in budgetList" :key="index" class="cusTable-tr">
                <td width="10%">
                  <!-- <el-button size="small" @click="PayDelete(index)" type="danger" class="dele">删除</el-button> -->
                  <div class="oper-btn-wrapper">
                    <button size="small" @click="PayDelete(index)" class="oper-btn"><img class="common-icon" src="/static/content/images/Common/common-dele.png"/></button>
                    <button size="small" @click="addBudgetlist" class="oper-btn"><img class="common-icon" src="/static/content/images/Common/common-add.png"/></button>
                  </div>
                </td>
                <td width="35%">
                  <!-- 对方科目 -->
                  <el-select class="formVal full-box" filterable  style="width:90%" v-model="i.accountItem" @visible-change="changeAccountItem(index,i.accountItem, $event)">       
                    <el-option v-for="(item,index) in AccountItemList" :value="item.AccountItem_Code" :key="index" :label="item.AccountItem_FullName">
                    </el-option>
                  </el-select>    
                </td>
                <td width="35%">
                  <!-- 辅助核算项目 -->
                  <div class="name-wrapper"><el-tag type="danger" v-if='i.name'>{{i.name}}</el-tag></div>
                  <div class="assistItem-wrapper">
                    <el-select class="formVal full-box" filterable v-model="i.assistItem">       
                      <el-option v-for="(item,index) in AssistItemList[index]" :value="item.AI_Code" :key="index" :label="item.AI_Name">
                      </el-option>
                    </el-select>
                  </div>
                </td>
                <td>
                  <el-input type="text" v-model="i.Money"  @blur="doToFixed(i,'Money')" @keyup.native="onlyNumObjFn(i,'Money')" @keydown.enter.native="addBudgetlist" class="formval-money full-box" placeholder="请输入金额"></el-input>
                </td>
              </tr>
            </table>
            <div class="clearfloat">
              <div class="total-box">合计：<span class="Count-text">{{Count2}}</span></div>
            </div> 
          </div>
        </div>
      </div>    
    </div>
    <!--附件-->
    <el-dialog title="附件" :visible.sync="dialogUploadVisible" :modal-append-to-body="false" >
      <label for="file" class="label-file"><i class="icon iconfont icon-shangchuan">&nbsp;</i>上传</label>
      <input name="file" id="file" type="file" accept="*" @change="update" multiple/>
      <div><br></div>
      <ul ref="images" style="display:none">
        <li v-for="(item, index) in UploadList" :key="index">
          <!-- <img :src="`http://192.168.1.188:8011/${item.Attachment_Url}`" :alt="item.Attachment_FileName"> -->
          <img :src="item.Attachment_Url" :alt="item.Attachment_FileName">
        </li>          
      </ul>
      <el-table :data="UploadList" header-align="center" id="test">
        <el-table-column property="ID" label="ID" width="100"></el-table-column>
        <el-table-column property="Attachment_UploadDate" label="日期" :formatter="formatUploadDate"></el-table-column>
        <el-table-column property="Attachment_FileName" label="名称" show-overflow-tooltip></el-table-column>          
        <el-table-column label="操作" max-width="100">
          <template slot-scope="scope">
            <div style="display:inline-block;">
            <el-button v-if='isShowPreview(scope.row.Attachment_FileName)' type="info" size="small" @click="preview(scope)">
              &#12288;<i class="el-icon-search"></i>预览&#12288;
            </el-button>
            </div>
            <a class="down" :href="scope.row.Attachment_Url" :download='scope.row.Attachment_FileName'>下载</a>
            <el-button type="danger" size="small" @click="DeleUpload(scope.$index, scope.row)">&#12288;删除&#12288;</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
    <!--借款单处理打印窗口-->
    <el-dialog :visible.sync="BorrowPrintHandleVisible" :modal-append-to-body="false">
				<div class="printBox cover">
					<el-button size="small" class="center" @click.native="printBorrowPdf2()">&#12288;打印&#12288;</el-button>
					<div id="formBorrow2">
            <table width="100%" border="0">
              <caption>
                <h3 id="Doc">{{BusinessObj.ER_Tite || ''}}</h3>
              </caption>
              <tbody>
                <tr>
                  <td>
                    <div id="div" class="table-c">
                      <table cellpadding="3" width="100%" class="ListTable">
                        <tbody>
                          <tr>
                            <td class="tbTitle">单据日期：</td>
                            <td class="Tabletd">{{BusinessObj.dt[0].Borrow_DocDate}}</td>
                            <td class="tbTitle">业务类型：</td>
                            <td class="Tabletd">{{BusinessObj.dt[0].BusinessTypeName}}</td>
                          </tr>
                          <tr>
                            <td class="tbTitle">供应商名称：</td>
                            <td class="Tabletd">{{BusinessObj.dt[0].Name}}</td>
                            <td class="tbTitle">借款金额合计：</td>
                            <td class="Tabletd">{{BusinessObj.dt[0].Borrow_TotalBorrowMoney}}</td>
                          </tr>
                          <tr>
                            <td class="tbTitle">付款方式：</td>
                            <td class="Tabletd">{{PayAccountItemString(BusinessObj.dt[0].Borrow_PayAccountItem)}}</td>
                            <td class="tbTitle">收款银行：</td>
                            <td class="Tabletd">{{BusinessObj.dt[0].Borrow_RcvBank}}</td>
                          </tr>
                          <tr>
                            <td class="tbTitle">银行账号：</td>
                            <td class="Tabletd">{{BusinessObj.dt[0].Borrow_RcvBankAccount}}</td>
                            <td class="tbTitle">现金期间：</td>
                            <td class="Tabletd">{{PeriodString(BusinessObj.dt[0].Borrow_CashPeriod)}}</td>
                          </tr>
                          <tr>
                            <td class="tbTitle">类型：</td>
                            <td class="Tabletd">{{BusinessObj.ER_Tite}}</td>
                            <td class="tbTitle">用途：</td>
                            <td class="Tabletd">{{BusinessObj.dt[0].Borrow_Title}}</td>
                          </tr>
                          <tr>
                            <td class="tbTitle">单号：</td>
                            <td class="Tabletd">{{BusinessObj.dt[0].Borrow_DocNO}}</td>
                            <td class="tbTitle">状态：</td>
                            <td class="Tabletd">{{BusinessObj.dt[0].DocStatus}}</td>
                          </tr>
                          <tr>
                            <td class="tbTitle">权责期间：</td>
                            <td class="Tabletd">{{BusinessObj.dt[0].Borrow_AccountPeriod}}</td>
                            <td class="tbTitle">申请人：</td>
                            <td class="Tabletd">{{BusinessObj.dt[0].UserName}}</td>
                          </tr>
                          <tr>
                            <td class="tbTitle">申请部门：</td>
                            <td class="Tabletd">{{BusinessObj.dt[0].Dept_Name}}</td>
                            <td class="tbTitle">现金流量类型：</td>
                            <td class="Tabletd">{{CashFlowItemString(BusinessObj.dt[0].Borrow_CashFlowItem)}}</td>
                          </tr>
                          <tr>
                            <td class="tbTitle">标题：</td>
                            <td class="Tabletd">{{BusinessObj.dt[0].Borrow_Title}}</td>
                            <td class="tbTitle"></td>
                            <td class="Tabletd"></td>
                          </tr>
                        </tbody>
                      </table>
                    </div>
                  </td>
                </tr>
              </tbody>
            </table>
          </div>
				</div>
    </el-dialog>
    <!--借款单流程打印窗口-->
		<el-dialog :visible.sync="BorrowPrintVisible" :modal-append-to-body="false">
				<div class="printBox cover">
					<el-button size="small" class="center" @click.native="printBorrowPdf()">&#12288;打印&#12288;</el-button>
					<div id="formBorrow">
            <table width="100%" border="0" v-loading="PrintLoading" element-loading-text="正在加载中">
              <caption>
                <h3 id="Doc">{{printsData.ER_Tite || ''}}</h3>
              </caption>
              <thead>
                <tr>
                  <td style="padding:15px 10px;line-height:30px;">
                    <div id="CompanyName" style="float:left">{{printsData.CompanyName || ''}}</div>
                    <div id="Current" style="float:right">打印日期：{{printsData.Current || ''}}</div>
                  </td>
                </tr>
              </thead>
              <tbody>
                <tr>
                  <td>
                    <div id="div" class="table-c">
                      <table cellpadding="3" width="100%" class="ListTable">
                        <tbody>
                          <tr>
                            <td class="tbTitle">单号</td>
                            <td class="Tabletd">{{printsData.entity ? printsData.entity.DocNo : '' }}</td>
                            <td class="tbTitle">申请人</td>
                            <td class="Tabletd">{{printsData.entity ? printsData.entity.CreateByName : ''}}</td>
                            <td class="tbTitle">申请部门</td>
                            <td class="Tabletd">{{printsData.entity ? printsData.entity.RequestDeptName : ''}}</td>
                          </tr>
                          <tr>
                            <td class="tbTitle">单据日期</td>
                            <td class="Tabletd">{{printsData.entity ? printsData.entity.DocDateStr : ''}}</td>
                            <td class="tbTitle">业务类型</td>
                            <td class="Tabletd">{{printsData.entity.BusinessType==2?'对私':'对公'}}</td>
                            <td class="tbTitle">供应商</td>
                            <td class="Tabletd">{{printsData.entity ? printsData.entity.SupplierName : ''}}</td>
                          </tr>
                          <tr>
                            <td class="tbTitle">借款金额</td>
                            <td class="Tabletd">{{printsData.entity && printsData.entity.TotalBorrowMoney ? printsData.entity.TotalBorrowMoney.toFixed(2) : '0.00'}}</td>
                            <td class="tbTitle">开户银行</td>
                            <td class="Tabletd">{{printsData.entity ? printsData.entity.RcvBank : ''}}</td>
                            <td class="tbTitle">银行账号</td>
                            <td class="Tabletd">{{printsData.entity ? printsData.entity.RcvBankAccount : ''}}</td>
                          </tr>
                          <tr>
                            <td class="tbTitle">业务描述</td>
                            <td colspan="5" class="Tabletd">
                              {{printsData.entity ? printsData.entity.Title : ''}}
                            </td>
                          </tr>
                        </tbody>
                      </table>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td style="line-height:30px;">&nbsp;</td>
                </tr>
                <tr>
                  <td>
                    <div id="Line" class="table-c">
                      <table width="100%" class="ListTable">
                        <thead>
                          <tr>
                            <td width="5%">NO</td>
                            <td>预算树</td>
                            <td>预算组织</td>
                            <td>预算科目</td>
                            <td>借款金额</td>
                          </tr>
                        </thead>
                        <tbody>
                          <tr v-for="(p,index) in printsData.entity.BorrowLineSet" :key="index">
                            <td>{{index+1}}</td>
                            <td>{{p.YBDEntity.YearBudgetName ? p.YBDEntity.YearBudgetName : ''}}</td>
                            <td>{{p.YBDEntity.DepartmentName ? p.YBDEntity.DepartmentName : ''}}</td>
                            <td>{{p.YBDEntity.BudgetItemName ? p.YBDEntity.BudgetItemName : ''}}</td>
                            <td>{{p && p.BorrowMoney ? p.BorrowMoney.toFixed(2) : ''}}</td>
                          </tr>
                          <tr>
                            <td colspan="4">合计</td>
                            <td>{{printsData.entity && printsData.entity.BorrowLineSetMoney ? printsData.entity.BorrowLineSetMoney.toFixed(2):'0.00'}}</td>
                          </tr>
                        </tbody>
                      </table>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td style="line-height:30px;">&nbsp;</td>
                </tr>
                <tr>
                  <td>
                    <div id="Line" class="table-c">
                      <table width="100%" class="ListTable">
                        <thead>
                          <tr>
                            <td width="5%">NO</td>
                            <td>处理人</td>
                            <td>处理结果</td>
                            <td>备注</td>
                            <td>处理日期</td>
                          </tr>
                        </thead>
                        <tbody>
                          <tr v-for="(p,index) in printsData.Chart" :key="index">
                            <td>{{index+1}}</td>
                            <td>{{p.PlanUser ? p.PlanUser : ''}}</td>
                            <td>{{p.StepName ? p.StepName : ''}}</td>
                            <td>{{p.OpRemark ? p.OpRemark : ''}}</td>
                            <td>{{p.OpDate ? p.OpDate : ''}}</td>
                          </tr>
                        </tbody>
                      </table>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <!--审批流-->
                  <td>
                    <div id="Chart" class="table-c"></div>
                  </td>
                </tr>
              </tbody>
            </table>
					</div>
				</div>
		</el-dialog>
    <!--报销单流程打印窗口-->
    <el-dialog :visible.sync="ExpensePrintVisible" :modal-append-to-body="false">
          <div class="printBox cover">
            <el-button size="small" class="center" @click.native="printExpensePdf()">&#12288;打印&#12288;</el-button>
            <div id="formExpense">
              <table width="100%" border="0" v-loading="PrintLoading" element-loading-text="正在加载中">
                <caption>
                  <h3 id="Doc">{{printsData.ER_Tite || ''}}</h3>
                </caption>
                <thead>
                  <tr>
                    <td style="padding:15px 10px;line-height:30px;">
                      <div id="CompanyName" style="float:left">{{printsData.CompanyName || ''}}</div>
                      <div id="Current" style="float:right">打印日期：{{printsData.Current || ''}}</div>
                    </td>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td>
                      <div id="div" class="table-c">
                        <table cellpadding="3" width="100%" class="ListTable">
                          <tbody>
                            <tr>
                              <td class="tbTitle">单号</td>
                              <td class="Tabletd">{{printsData.entity ? printsData.entity.DocNo : '' }}</td>
                              <td class="tbTitle">申请人</td>
                              <td class="Tabletd">{{printsData.entity ? printsData.entity.RequestEmpName : ''}}</td>
                              <td class="tbTitle">申请部门</td>
                              <td class="Tabletd">{{printsData.entity ? printsData.entity.RequestDeptName : ''}}</td>
                            </tr>
                            <tr>
                              <td class="tbTitle">单据日期</td>
                              <td class="Tabletd">{{printsData.entity ? printsData.entity.DocDateStr : ''}}</td>
                              <td class="tbTitle">业务类型</td>
                              <td class="Tabletd">{{printsData.entity.BusinessType==2?'对私':'对公'}}</td>
                              <td class="tbTitle">供应商</td>
                              <td class="Tabletd">{{printsData.entity ? printsData.entity.SupplierName : ''}}</td>
                            </tr>
                            <tr>
                              <td class="tbTitle">申请金额</td>
                              <td class="Tabletd">{{printsData.entity && printsData.entity.TotalRequestMoney ? printsData.entity.TotalRequestMoney.toFixed(2) : '0.00'}}</td>
                              <td class="tbTitle">本次付款金额</td>
                              <td class="Tabletd">{{printsData.entity && printsData.entity.TotalLeaveMoney ? printsData.entity.TotalLeaveMoney.toFixed(2) : '0.00'}}</td>
                              <td class="tbTitle">开户银行</td>
                              <td class="Tabletd">{{printsData.entity ? printsData.entity.RcvBank : ''}}</td>
                            </tr>
                            <tr>
                              <td class="tbTitle">银行账号</td>
                              <td class="Tabletd">
                                {{printsData.entity ? printsData.entity.RcvBankAccount:''}}
                              </td>
                              <td class="tbTitle">业务描述</td>
                              <td colspan="3" class="Tabletd">
                                {{printsData.entity ? printsData.entity.Title : ''}}
                              </td>                 
                            </tr>
                          </tbody>
                        </table>
                      </div>
                    </td>
                  </tr>
                  <tr v-if="printsData.entity && printsData.entity.ExpenseBorrowLineSet && printsData.entity.ExpenseBorrowLineSet.length>0">
                    <td style="line-height:30px;">&nbsp;</td>
                  </tr>
                  <tr v-if="printsData.entity && printsData.entity.ExpenseBorrowLineSet && printsData.entity.ExpenseBorrowLineSet.length>0">                   
                    <td>
                      <div id="Line" class="table-c">
                        <table width="100%" class="ListTable">
                          <thead>
                            <tr>
                              <td width="5%">NO</td>
                              <td>借款单号</td>
                              <td>借款金额</td>
                              <td>未核销金额</td>
                              <td>本次核销金额</td>
                            </tr>
                          </thead>
                          <tbody>
                            <tr v-for="(p,index) in printsData.entity.ExpenseBorrowLineSet" :key="index">
                              <td>{{index+1}}</td>
                              <td>{{p.BorrowDoc ? p.BorrowDoc : ''}}</td>
                              <td>{{p && p.TotalBorrowMoney ? p.TotalBorrowMoney.toFixed(2) : ''}}</td>
                              <td>{{p && p.CurrentLeaveMoney ? p.CurrentLeaveMoney.toFixed(2) :''}}</td>
                              <td>{{p && p.WriteOffMoney ? p.WriteOffMoney.toFixed(2) :''}}</td>
                            </tr>
                            <tr>
                              <td colspan="4">合计</td>
                              <td>{{printsData.entity && printsData.entity.ExpenseBorrowLineSetMoney ? printsData.entity.ExpenseBorrowLineSetMoney.toFixed(2):'0.00'}}</td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td style="line-height:30px;">&nbsp;</td>
                  </tr>
                  <tr>
                    <td>
                      <div id="Line" class="table-c">
                        <table width="100%" class="ListTable">
                          <thead>
                            <tr>
                              <td width="5%">NO</td>
                              <td>预算树</td>
                              <td>预算组织</td>
                              <td>预算科目</td>
                              <td>借款金额</td>
                            </tr>
                          </thead>
                          <tbody>
                            <tr v-for="(p,index) in printsData.entity.ExpenseLineSet" :key="index">
                              <td>{{index+1}}</td>
                              <td>{{p.YBDEntity.YearBudgetName ? p.YBDEntity.YearBudgetName : ''}}</td>
                              <td>{{p.YBDEntity.DepartmentName ? p.YBDEntity.DepartmentName : ''}}</td>
                              <td>{{p.YBDEntity.BudgetItemName ? p.YBDEntity.BudgetItemName : ''}}</td>
                              <td>{{p && p.RequestMoney ? p.RequestMoney.toFixed(2) : ''}}</td>
                            </tr>
                            <tr>
                              <td colspan="4">合计</td>
                              <td>{{printsData.entity && printsData.entity.ExpenseLineSetMoney ? printsData.entity.ExpenseLineSetMoney.toFixed(2):'0.00'}}</td>                    
                            </tr>
                          </tbody>
                        </table>
                      </div>
                    </td>
                  </tr>
                  <tr v-if="printsData.entity && printsData.entity.ExpenseTradeLineSet && printsData.entity.ExpenseTradeLineSet.length>0"><td style="line-height:30px;">&nbsp;</td></tr>
                  <tr v-if="printsData.entity && printsData.entity.ExpenseTradeLineSet && printsData.entity.ExpenseTradeLineSet.length>0">     
                  <td>
                      <div id="Line" class="table-c">
                        <table width="100%" class="ListTable">
                          <thead>
                            <tr>
                              <td width="5%">NO</td>
                              <td>挂账科目</td>
                              <td>往来单位</td>
                              <td>挂账金额</td>
                            </tr>
                          </thead>
                          <tbody>
                            <tr v-for="(p,index) in printsData.entity.ExpenseTradeLineSet" :key="index">
                              <td>{{index+1}}</td>
                              <td>{{p.AccountItemName ? p.AccountItemName : ''}}</td>
                              <td>{{p.AssistItemName ? p.AssistItemName : ''}}</td>
                              <td>{{p && p.TradeMoney ? p.TradeMoney.toFixed(2) : ''}}</td>
                            </tr>
                            <tr>
                              <td colspan="3">合计</td>
                              <td>{{printsData.entity && printsData.entity.ExpenseTradeLineSetMoney ? printsData.entity.ExpenseTradeLineSetMoney.toFixed(2):'0.00'}}</td>          
                            </tr>
                          </tbody>
                        </table>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td style="line-height:30px;">&nbsp;</td>
                  </tr>
                  <tr>
                    <td>
                      <div id="Line" class="table-c">
                        <table width="100%" class="ListTable">
                          <thead>
                            <tr>
                              <td width="5%">NO</td>
                              <td>处理人</td>
                              <td>处理结果</td>
                              <td>备注</td>
                              <td>处理日期</td>
                            </tr>
                          </thead>
                          <tbody>
                            <tr v-for="(p,index) in printsData.Chart" :key="index">
                              <td>{{index+1}}</td>
                              <td>{{p.PlanUser ? p.PlanUser : ''}}</td>
                              <td>{{p.StepName ? p.StepName : ''}}</td>
                              <td>{{p.OpRemark ? p.OpRemark : ''}}</td>
                              <td>{{p.OpDate ? p.OpDate : ''}}</td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                  </tr>
                  <tr>
                    <!--审批流-->
                    <td>
                      <div id="Chart" class="table-c"></div>
                    </td>
                  </tr>
                </tbody>
              </table>
          </div>
        </div>
    </el-dialog>
    <!--报销单处理打印窗口-->
    <el-dialog :visible.sync="ExpensePrintHandleVisible" :modal-append-to-body="false">
        <div class="printBox cover">
          <el-button class="center" size="small" @click="printExpensePdf2()">&#12288;打印&#12288;</el-button>
          <div id="formExpense2">
            <table width="100%" border="0">
              <caption>
                <h3 id="Doc">{{ExpenseObj.ER_Tite || ''}}</h3>
              </caption>
              <tbody>
                <tr>
                  <td>
                    <div id="div" class="table-c">
                      <table cellpadding="3" width="100%" class="ListTable">
                        <tbody>
                          <tr>
                            <td class="tdTitle">单据日期</td>
                            <td class="Tabletd">{{ExpenseObj.dt[0].Expense_DocDate}}</td>
                            <td class="tdTitle">业务类型</td>
                            <td class="Tabletd">{{ExpenseObj.dt[0].BusinessTypeName}}</td>
                          </tr>
                          <tr>
                            <td class="tdTitle">供应商</td>
                            <td class="Tabletd">{{ExpenseObj.dt[0].Name}}</td>
                            <td class="tdTitle">本次报销金额</td>
                            <td class="Tabletd">{{ExpenseObj.dt[0].Expense_TotalRequestMoney}}</td>
                          </tr>
                          <tr>
                            <td class="tdTitle">本次核销借款</td>
                            <td class="Tabletd">{{ExpenseObj.dt[0].Repayment}}</td>
                            <td class="tdTitle">本次付款金额</td>
                            <td class="Tabletd">{{ExpenseObj.dt[0].Payment}}</td>
                          </tr>
                          <tr>
                            <td class="tdTitle">付款方式</td>
                            <td class="Tabletd">{{PayAccountItemString(ExpenseObj.dt[0].Expense_PayAccountItem)}}</td>
                            <td class="tdTitle">收款银行</td>
                            <td class="Tabletd">{{ExpenseObj.dt[0].Expense_RcvBank}}</td>
                          </tr>
                          <tr>
                            <td class="tdTitle">银行账号</td>
                            <td class="Tabletd">{{ExpenseObj.dt[0].Expense_RcvBankAccount}}</td>
                            <td class="tdTitle">现金期间</td>
                            <td class="Tabletd">{{PeriodString(ExpenseObj.dt[0].Expense_CashPeriod)}}</td>
                          </tr>
                          <tr>
                            <td class="tdTitle">类型</td>
                            <td class="Tabletd">{{ExpenseObj.ER_Tite}}</td>
                            <td class="tdTitle">用途</td>
                            <td class="Tabletd">{{ExpenseObj.dt[0].Expense_Title}}</td>
                          </tr>
                          <tr>
                            <td class="tdTitle">单号</td>
                            <td class="Tabletd">{{ExpenseObj.dt[0].Expense_DocNO}}</td>
                            <td class="tdTitle">状态</td>
                            <td class="Tabletd">{{ExpenseObj.dt[0].DocStatus}}</td>
                          </tr>
                          <tr>
                            <td class="tdTitle">权责期间</td>
                            <td class="Tabletd">{{ExpenseObj.dt[0].Expense_AccountPeriod}}</td>
                            <td class="tdTitle">申请人</td>
                            <td class="Tabletd">{{ExpenseObj.dt[0].UserName}}</td>
                          </tr>
                          <tr>
                            <td class="tdTitle">现金流量类型</td>
                            <td class="Tabletd">{{CashFlowItemString(ExpenseObj.dt[0].Expense_CashFlowItem)}}</td>
                            <td class="tdTitle">申请部门</td>
                            <td class="Tabletd">{{ExpenseObj.dt[0].Dept_Name}}</td>
                          </tr>
                          <tr>
                            <td class="tdTitle">标题</td>
                            <td class="Tabletd">{{ExpenseObj.dt[0].Expense_Title}}</td>
                            <td class="tdTitle"></td>
                            <td class="Tabletd"></td>
                          </tr>
                        </tbody>
                      </table>          
                    </div>                  
                  </td>
                </tr>
              </tbody>
            </table>
          </div>
        </div>
    </el-dialog>
    <!--还款单处理打印-->
    <el-dialog :visible.sync="RefundPrintHandleVisible" :modal-append-to-body="false">
          <div class="printBox cover">
            <el-button size="small" class="center" @click.native="printRefundPdf2()">&#12288;打印&#12288;</el-button>
            <div id="formRefund2">
              <table width="100%" border="0">
              <caption>
                <h3 id="Doc">{{RefundMoneyObj.ER_Tite || ''}}</h3>
              </caption>
              <tbody>
                <tr>
                  <td>
                    <div id="div" class="table-c">
                      <table cellpadding="3" width="100%" class="ListTable">
                        <tbody>
                          <tr>
                            <td class="tbTitle">类型</td>
                            <td class="Tabletd">{{RefundMoneyObj.ER_Tite}}</td>
                            <td class="tbTitle">制单日期</td>
                            <td class="Tabletd">{{formatTime(RefundMoneyObj.dt[0].Repay_DocDate)}}</td>
                          </tr>
                          <tr>
                            <td class="tbTitle">单号</td>
                            <td class="Tabletd">{{RefundMoneyObj.dt[0].Repay_DocNO}}</td>
                            <td class="tbTitle">收款方式</td>
                            <td class="Tabletd">{{PayAccountItemString(RefundMoneyObj.dt[0].Repay_RcvAccountItem)}}</td>
                          </tr>
                          <tr>
                            <td class="tbTitle">状态</td>
                            <td class="Tabletd">{{RefundMoneyObj.dt[0].DocStatus}}</td>
                            <td class="tbTitle">申请人</td>
                            <td class="Tabletd">{{RefundMoneyObj.dt[0].UserName}}</td>
                          </tr>
                          <tr>
                            <td class="tbTitle">现金流量类型</td>
                            <td class="Tabletd">{{CashFlowItemString(RefundMoneyObj.dt[0].Repay_CashFlowItem)}}</td>
                            <td class="tbTitle">申请部门</td>
                            <td class="Tabletd">{{RefundMoneyObj.dt[0].Dept_Name}}</td>
                          </tr>
                          <tr>
                            <td class="tbTitle">现金期间</td>
                            <td class="Tabletd">{{PeriodString(RefundMoneyObj.dt[0].Repay_CashPeriod)}}</td>
                            <td class="tbTitle">标题</td>
                            <td class="Tabletd">{{RefundMoneyObj.dt[0].Repay_Title}}</td>
                          </tr>
                          <tr>
                            <td class="tbTitle">还款金额合计</td>
                            <td class="Tabletd">{{RefundMoneyObj.dt[0].Repayment}}</td>
                            <td class="tbTitle">权责期间</td>
                            <td class="Tabletd">{{RefundMoneyObj.dt[0].Repay_AccountPeriod}}</td>
                          </tr>
                        </tbody>
                      </table>
                    </div>
                  </td>
                </tr>
              </tbody>
              </table>
            </div>
          </div>
    </el-dialog>
    <!--还款单流程打印窗口-->
    <el-dialog :visible.sync="RefundPrintVisible" :modal-append-to-body="false">
          <div class="printBox cover">
            <el-button size="small" class="center" @click.native="printRefundPdf()">&#12288;打印&#12288;</el-button>
            <div id="formRefund">
              <table width="100%" border="0" v-loading="PrintLoading" element-loading-text="正在加载中">
              <caption>
                <h3 id="Doc">{{printsData.ER_Tite || ''}}</h3>
              </caption>
              <thead>
                <tr>
                  <td style="padding:15px 10px;line-height:30px;">
                    <div id="CompanyName" style="float:left">{{printsData.CompanyName || ''}}</div>
                    <div id="Current" style="float:right">打印日期：{{printsData.Current || ''}}</div>
                  </td>
                </tr>
              </thead>
              <tbody>
                <tr>
                  <td>
                    <div id="div" class="table-c">
                      <table cellpadding="3" width="100%" class="ListTable">
                        <tbody>
                          <tr>
                            <td class="tbTitle">单号</td>
                            <td class="Tabletd">{{printsData.entity ? printsData.entity.DocNo : '' }}</td>
                            <td class="tbTitle">申请人</td>
                            <td class="Tabletd">{{printsData.entity ? printsData.entity.CreateByName : ''}}</td>
                            <td class="tbTitle">申请部门</td>
                            <td class="Tabletd">{{printsData.entity ? printsData.entity.CreateByDeptName : ''}}</td>
                          </tr>
                          <tr>
                            <td class="tbTitle">单据日期</td>
                            <td class="Tabletd">{{printsData.entity ? printsData.entity.DocDateStr : ''}}</td>
                            <td class="tbTitle">还款金额</td>
                            <td class="Tabletd">{{printsData.entity ? printsData.entity.TotalRepayMoney : ''}}</td>
                            <td class="tbTitle">业务描述</td>
                            <td class="Tabletd">{{printsData.entity ? printsData.entity.Title : ''}}</td>
                          </tr>
                        </tbody>
                      </table>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td style="line-height:30px;">&nbsp;</td>
                </tr>
                <tr>
                  <td>
                    <div id="Line" class="table-c">
                      <table width="100%" class="ListTable">
                        <thead>
                          <tr>
                            <td width="5%">NO</td>
                            <td>借款单号</td>
                            <td>借款日期</td>
                            <td>借款金额</td>
                            <td>欠款金额</td>
                            <td>本次还款金额</td>
                          </tr>
                        </thead>
                        <tbody>
                          <tr v-for="(p,index) in printsData.entity.RepayLineSet" :key="index">
                            <td>{{index+1}}</td>
                            <td>{{p.BorrowDocNo ? p.BorrowDocNo : ''}}</td>
                            <td>{{p.BorrowDocDate ? p.BorrowDocDate : ''}}</td>
                            <td>{{p.TotalBorrowMoney && p.TotalBorrowMoney ? p.TotalBorrowMoney.toFixed(2) :''}}</td>
                            <td>{{p.CurrentLeaveMoney && p.CurrentLeaveMoney ? p.CurrentLeaveMoney.toFixed(2) :''}}</td>
                            <td>{{p.RepayMoney && p.RepayMoney ? p.RepayMoney.toFixed(2) :''}}</td>                            
                          </tr>
                          <tr>
                            <td colspan="5">合计</td>
                            <td>{{printsData.entity && printsData.entity.RepayLineSetMoney ? printsData.entity.RepayLineSetMoney.toFixed(2):'0.00'}}</td>
                          </tr>
                        </tbody>
                      </table>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td style="line-height:30px;">&nbsp;</td>
                </tr>
                <tr>
                  <td>
                    <div id="Line" class="table-c">
                      <table width="100%" class="ListTable">
                        <thead>
                          <tr>
                            <td width="5%">NO</td>
                            <td>处理人</td>
                            <td>处理结果</td>
                            <td>备注</td>
                            <td>处理日期</td>
                          </tr>
                        </thead>
                        <tbody>
                          <tr v-for="(p,index) in printsData.Chart" :key="index">
                            <td>{{index+1}}</td>
                            <td>{{p.PlanUser ? p.PlanUser : ''}}</td>
                            <td>{{p.StepName ? p.StepName : ''}}</td>
                            <td>{{p.OpRemark ? p.OpRemark : ''}}</td>
                            <td>{{p.OpDate ? p.OpDate : ''}}</td>
                          </tr>
                        </tbody>
                      </table>
                    </div>
                  </td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <!--审批流-->
                  <td>
                    <div id="Chart" class="table-c"></div>
                  </td>
                </tr>
              </tbody>
            </table>
          </div>
        </div>
    </el-dialog>
    <!--查询-->
      <el-dialog title="查询" :visible.sync="dialogSearchVisible" :modal-append-to-body="false" size="tiny">
        <el-form :model="Searchform">
          <el-form-item label="金  额 ：" :label-width="formLabelWidth">
            <el-input v-model.number.trim="Searchform.StartMoney" auto-complete="off" style="width:120px;"></el-input>
            至&nbsp;<el-input v-model.number.trim="Searchform.EndMoney" auto-complete="off" style="width:120px;"></el-input>
          </el-form-item>
          <el-form-item label="日  期 ：" :label-width="formLabelWidth">
            <el-date-picker type="date" v-model="Searchform.StartDate" style="width:120px;" placeholder="选择日期"></el-date-picker>
            至&nbsp;<el-date-picker type="date" v-model="Searchform.EndDate" style="width:120px;" placeholder="选择日期"></el-date-picker>
          </el-form-item>
          <el-form-item label="业务类型 ：" :label-width="formLabelWidth">
            <el-select v-model="Searchform.Type" style="width:262px;" placeholder="请选择">
              <el-option value="" label="全部">全部</el-option>
              <el-option
                v-for="item in TypeOptions"
                :key="item.Code"
                :label="item.Name"
                :value="item.Code">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="单  号 ：" :label-width="formLabelWidth">
            <el-input v-model="Searchform.DocNo" style="width:262px;"></el-input>
          </el-form-item>
          <el-form-item label="标  题 ：" :label-width="formLabelWidth">
            <el-input v-model="Searchform.Title" style="width:262px;"></el-input>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer cover">
          <el-button size="small" @click="Reset">重 置</el-button>
          <el-button size="small" @click="Query">确 定</el-button>
        </div>
      </el-dialog>
    <!--凭证撤销-->
      <el-dialog title="单据撤销" :visible.sync="cancelToChangeVis" :modal-append-to-body="false" size="tiny">
        <div>
            <el-radio v-model="cancelToRadio" label="1">业务修改</el-radio>
            <el-radio v-model="cancelToRadio" label="2">业务新建</el-radio>
        </div>
        <el-input type="textarea" :rows="3" placeholder="请输入撤销建议"
         v-model="cancelAdive" class="textarea-title"></el-input>
        <div slot="footer" class="dialog-footer cover">
          <el-button size="small" @click="cancelToChangeVis=false">取 消</el-button>
          <el-button size="small" @click="comfirmCancelTo">确 定</el-button>
        </div>
      </el-dialog>     
    </div>
</section>
</template>
<script>
import moment from "moment";
// import axios from '../../../../new program/src/util/axios';
/* import "../../../static/jquery.jqprint-0.3"; */
export default {
  name: "Work",
  data() {
    return {
      viewer: null, //viewer对象
      total: 0, //数据总数
			rows: 100, //每页显示多少条
			currentPage: 1,//当前页数
      isshowList: true,
      isshowAddRcv: false, //收款
      isshowAddPay: false, //付款
      isShowPayment: true, //预收款
      isAdvanceDetails: true, //预收明细
      isSwitch: false, //开关是否预收款
      isShowPrint: false, //打印开关
      dialogSearchVisible:false,
      TypeOptions:[],
      DocNo: "",
      describe: "", //描述
      docDate: "",
      workList: [], //列表
      Customer: [], //客户
      custom: [], //客户
      PeriodList: [], //现金期间列表
      period: "", //现金期间model
      CollectionMoney: 0, //收款金额
      applyMoney: 0, //申请金额
      dialogUploadVisible: false, //上传窗口
      loading: false,
      PrintLoading: false,
      dialogRefundVisible: false, //还款
      dialogBusinessVisible: false, //借款
      dialogExpenseVisible: false, //报销
      dialogPayVisible: false,
      BorrowPrintVisible: false, //借款单流程打印
      BorrowPrintHandleVisible: false, //借款单处理打印
      RefundPrintVisible: false, //还款单流程打印
      RefundPrintHandleVisible: false, //还款单处理打印
      ExpensePrintVisible: false, //报销单流程打印
      ExpensePrintHandleVisible: false, //报销单处理打印
      RefundMoneyObj: {
        ER_Tite: "",
        dt: [{}]
      }, //还款单
      BusinessObj: {
        ER_Tite: "",
        dt: [{}]
      }, //借款单
      ExpenseObj: {
        ER_Tite: "",
        dt: [
          {
            bank: "",
            bankAccount: ""
          }
        ]
      },
      formLabelWidth: "125px",
      ReceivingTypeList: [], //收付款方式列表
      UploadList: [], //附件列表数据
      receivingType: "", //收付款方式model
      paymentsTemp: [],
      paymentsPrint: [
        {
          Income_DocNo: "",
          Income_Title: "",
          Income_TotalIncomeMoney: 0,
          Surplus: 0,
          Money: 0
        }
      ],
      CashFlowList: [], //现金流量列表
      cashFlow: "", //现金流量model
      bank: "", //供应商银行model
      bankList: [], //供应商银行
      bankAccount: "", //银行卡号
      SupplierList: [], //供应商列表
      supplier: "", //供应商model
      state: 0, //判断是付款单还是收款单
      detail: [
        {
          IncomeMoney: '', //金额
          Department: "", //部门
          BudgetItem: "" //类型
        }
      ],
      printsData: {
        entity: {
          BorrowLineSet: []
        }
      },
      Searchform: {
          StartMoney:0,
          EndMoney:0,
          StartDate:'',
          EndDate:'',
          DocNo:'',
          Title:'',
          Type:'',
      },
      budgetItemList: [], //收入类型
      baseDeptList: [], //部门
      AccountItemList: [], //获取对方科目列表
      AssistItemList: [], //辅助核算项目
      budgetList: [
        {
          Money: '', //金额
          accountItem: "", //对方科目
          assistItem: "" //辅助核算项目
        }
      ],
      DocType: null,
      mouse_enter_Rcv_DocNO:"",//鼠标移入当前行的单号
      cancelTarget:"",//撤销的单据
      cancelToChangeVis:false,//撤销到编辑或新增
      cancelToRadio:0,
      cancelAdive:""
    };
  },
  methods: {
    comfirmCancelTo(){//确定撤销
      // console.log(this.cancelToRadio,"cancelToRadio:1是编辑，2是新增")
      // console.log(this.cancelAdive,"cancelAdive建议")
      //revoToEdit
      //revoToNews
      if (this.cancelToRadio===0) {
          this.$message({
            message: "请选择撤销类型",
            type: "warning"
          });
          return;
      }
      axios.get("revoToWork",{
        DocNo: this.cancelTarget.DocNO,
        DocType: this.cancelTarget.Type,
        News: this.cancelAdive,
        Type: this.cancelToRadio//1是撤销到编辑，2是撤销到新增
      }).then(res=>{
        if(res=='ok'){
          this.$message({
            message: "撤销成功",
            type: "success"
          });
          this.cancelToChangeVis=false
          setTimeout(() => {
            this.getList();
          }, 500);          
        }else{
          this.$message({
            type: "warning",
            message: res
          });
          setTimeout(() => {
            this.getList();
          }, 500); 
        }
      }).catch(err=>{
        console.log(err)
      })
      // this.$prompt("请输入您让单据提交者修改的内容：", "提示", {
      //   confirmButtonText: "确定",
      //   cancelButtonText: "取消"
      // }).then(({ value }) => {
      //   this.$message({
      //     type: "success",
      //     message: "你输入的是: " + value
      //   });
      //     axios.get("revoToWork", {
      //         DocNo: row.DocNO,
      //         DocType: row.Type,
      //         News: value,
      //         Type: 1
      //       }).then(res => {
      //         if (res == "ok") {
      //           this.$message({
      //             message: "撤销成功",
      //             type: "success"
      //           });
      //           setTimeout(() => {
      //             this.getList();
      //           }, 500);
      //         } else {
      //           this.$message({
      //             type: "warning",
      //             message: res
      //           });
      //           setTimeout(() => {
      //             this.getList();
      //           }, 500);
      //         }
      //       })
      //       .catch(err => {
      //         console.log(err);
      //       });        
      // })
      // .catch(() => {
      //   this.$message({
      //     type: "info",
      //     message: "取消输入"
      //   });
      // });

    },
    revoToChange(obj){//撤销到编辑或新增
      // console.log(obj,"obj")
      //打开弹框，清空弹框内容
      this.cancelToRadio=0;
      this.cancelAdive="";

      this.cancelToChangeVis=true;
      this.cancelTarget=obj;
      
    },
    doCloseFn(){
      this.dialogPayVisible = false;
      // console.log("doCloseFn")
      // console.log(this.paymentsTemp,"paymentsTemp弹框");
      // console.log(this.paymentsPrint,"paymentsPrint当前表格");
      this.paymentsTemp.forEach(aItem=>{
        if (this.paymentsPrint.findIndex(bItem=>aItem.Income_DocNo===bItem.Income_DocNo)==-1) {
          aItem.Money=''
        }
      })
    },
    changeMoneyToZero(obj){
      // console.log(obj,"obj")
      // console.log(this.paymentsTemp,"paymentsTemp弹框");
      // console.log(this.paymentsPrint,"paymentsPrint当前表格");
      let dele_Rcv_DocNO=obj.row.Rcv_DocNO;
      this.paymentsPrint.splice(obj.$index,1);
      this.paymentsTemp.forEach(item=>{
        if (item.Rcv_DocNO==dele_Rcv_DocNO) {
          item.Money=""
        }
      })
    },
    cellMouseEnterTwoFn(...arr){//鼠标移速单元格触发事件
      this.mouse_enter_Rcv_DocNO=arr[0].DocNO
    },
    cellMouseEnterFn(...arr){//鼠标移速单元格触发事件
      this.mouse_enter_Rcv_DocNO=arr[0].Rcv_DocNO
    },
    cellMouseLeaveFn(){
      this.mouse_enter_Rcv_DocNO=""
    },
    // 获取付款方式的中文字段。
    PayAccountItemString(id) {
      // 根据这个id 去找
      const result = this.ReceivingTypeList.filter(
        item => item.AccountItem_Code == id
      );
      return result[0] ? result[0].AccountItem_Name : "";
    },
    // 获取现金流量类型的中文字段
    CashFlowItemString(id) {
      const result = this.CashFlowList.filter(
        item => item.CashFlowItem_Code == id
      );
      return result[0] ? result[0].CashFlowItem_Name : "";
    },
    // 获取现金期间的中文字段
    PeriodString(id) {
      const result = this.PeriodList.filter(item => item.Period_Code == id);
      return result[0] ? result[0].Period_Name : "";
    },
    formatDate(row, column) {
      return row.DocDate.split("T", 1);
    },
    formatUploadDate(row, column) {
      return row.Attachment_UploadDate.split("T", 1);
    },
    getStart() {
      this.state = this.$route.params.num;
    },
    //获得部门和收入类型
    async getIncomeBudget() {
      const res = await axios.get("getIncomeBudget")
      this.budgetItemList = res.Base_BudgetItem; //收入类型
      this.baseDeptList = res.Base_Dept; //部门
    },
    showChange(isSwitch) {
      this.isShowPayment = !isSwitch;
      this.isAdvanceDetails = isSwitch;
      if (!this.isSwitch) {//关闭预收明细，清空数据
        this.paymentsPrint.length=0;
        this.detail.length=0;
        this.addlist();
      }
      
    },
    changeCustom(e) {
      this.paymentsPrint = [];
    },
    changePage(page) {//当前页数
			this.currentPage = page;
			this.getList();
		},
    async getList() {
      let Type = this.state===1?0:1;
      console.log(this.state===1?"出纳收款单":"出纳付款单");
      this.loading = true;
      const res = await axios.get("getWorkList",{
        page:this.currentPage,
        rows:this.rows,
        Type:Type
      })
      this.total = res.total;
      this.workList = res.rows;
      this.loading = false;
    },
    search(){
			this.dialogSearchVisible = true;
			this.getTypes();
		},
    async getTypes(){
			this.TypeOptions = await axios.get('getTypeOptions');
    },
    /*
		*  查询 
		*/
		async Query(){
    if(new Date(this.Searchform.StartDate)>new Date(this.Searchform.EndDate)){
			console.log(new Date(this.Searchform.StartDate),'this.Searchform.StartDate')
			console.log(new Date(this.Searchform.EndDate),'this.Searchform.EndDate')
			this.$message({
			message: '开始日期必须小于或者等于结束时期！',
			type: 'warning',
			duration: 1200
			});
			return;
		}else if(this.Searchform.StartMoney>this.Searchform.EndMoney){
			this.$message({
			message: '开始金额必须小于或者等于结束金额！',
			type: 'warning',
			duration: 1200
			});
			return;
		}
		this.dialogSearchVisible = false;
		let filterName = {
			"groupOp": "AND",
			"rules": [{
			"field": "DocNO",
			"dataType": "string",
			"op": "cn",
			"data": this.Searchform.DocNo || ''
			},{
			"field": "Title",
			"dataType": "string",
			"op": "cn",
			"data": this.Searchform.Title || ''
			},{
			"field": "Type",
			"dataType": "numeric",
			"op": "eq",
			"data": this.Searchform.Type || ''
			},{
			"field": "TotalMoney",
			"dataType": "numeric",
			"op": "ge",
			"data": this.Searchform.StartMoney || ''
			}, {
			"field": "TotalMoney",
			"dataType": "numeric",
			"op": "le",
			"data": this.Searchform.EndMoney || ''
			}, {
			"field": "DocDate",
			"dataType": "string",
			"op": "ge",
			"data": this.Searchform.StartDate ? moment(this.Searchform.StartDate).format('L') : ''
			}, {
			"field": "DocDate",
			"dataType": "string",
			"op": "le",
			"data": this.Searchform.EndDate ? moment(this.Searchform.EndDate).add(1,"d").format('L') : ''
			}],
			"groups": []
		}
    this.loading = true;
    let Type = this.state === 1 ? 0 : 1;
		const res = await axios.post("getWorkList", { 
			filter:JSON.stringify(filterName),
			Type:Type,
			page:this.currentPage,
			rows:this.rows,
		});
		this.total = res.total;//总页数
		this.workList = res.rows;
		this.loading = false;
		},
		Reset(){
			this.Searchform = {
				StartMoney:0,
				EndMoney:0,
				StartDate:'',
				EndDate:'',
				DocNo:'',
				Type:'',
				Title:'',
			}
		},
    //付款删除
    PayDelete(index) {
      this.$confirm("确认删除该记录吗?", "提示", {
        type: "warning"
      }).then(() => {
        this.budgetList.splice(index, 1);
        this.AssistItemList.splice(index, 1);
        this.$message({
          message: "已删除",
          type: "success"
        });
      }).then(()=>{
        if (this.budgetList.length==0) {
          this.addBudgetlist()
        }
      });
    },
    //收款删除
    RvcDelete(index) {
      this.$confirm("确认删除该记录吗?", "提示", {
        type: "warning"
      }).then(() => {
        this.detail.splice(index, 1);
        this.$message({
          message: "已删除",
          type: "success"
        });
        if (this.detail.length==0) {
          this.addlist();
        }
      });
    },

    handleAdd() {
      this.detail=[];
      this.addlist();
      if (this.state === 1) {
        //新建收款单
        this.isshowAddRcv = true; //新建 出纳收款单 页面显示
        this.isshowAddPay = false;
        this.isshowList = false; //列表页面隐藏
        this.docDate = new Date();
        /* this.getCustomer(); */
        this.Customer = [];//清空远程客户输入框
        this.getReceivingType();
        this.getIncomeBudget();
        this.DocType = 402;
        this.paymentsPrint.length = 0;
        this.budgetItemList.length = 0;
        this.baseDeptList.length = 0;
        this.PeriodList.length = 0;
        this.describe = "";
        this.DocNo = "";
        this.period = "";
        this.custom = "";
        this.CollectionMoney = "";
        this.receivingType = "";
        // this.detail.length = 0;
        this.isSwitch = false;
        this.isShowPayment = true;
        this.isAdvanceDetails = false;
        this.getPeriod();
      } else {
        //新建付款单
        this.isshowAddPay = true; //新建 出纳付款单 页面显示
        this.isshowAddRcv = false;
        this.isshowList = false; //列表页面隐藏
        this.DocType = 401;
        this.docDate = new Date();
        this.getSupplier(); //供应商
        this.getCashFlow(); //现金流量类型
        this.getReceivingType(); //付款方式
        this.getPeriod(); //现金期间
        this.supplier = "";
        this.bank = "";
        this.DocNo = "";
        this.describe = "";
        this.cashFlow = "";
        this.receivingType = "";
        this.period = "";
        this.bankAccount = "";
        this.applyMoney = "";
      }
    },
    addBudgetlist() {
      this.budgetList.push({
        Money: '', //金额
        accountItem: "", //对方科目
        assistItem: "" //辅助核算项目
      });
    },
    //借款处理打印窗口
    getBorrowHandlePrint() {
      this.BorrowPrintHandleVisible = true;
    },
    //借款单流程打印窗口
    async getBorrowPrint() {
      this.printsData = {
        entity: {
          BorrowLineSet: []
        }
      };
      this.BorrowPrintVisible = true;
      this.PrintLoading = true;
      this.printsData = await axios.get("Print", {
        DocNo: this.DocNo,
        DocType: this.DocType
      });
      this.PrintLoading = false;
    },
    //报销单处理打印窗口
    getExpenseHandlePrint() {
      this.ExpensePrintHandleVisible = true;
    },
    //报销单流程打印窗口
    async getExpensePrint() {
      this.printsData = {
        entity: {
          BorrowLineSet: []
        }
      };
      this.ExpensePrintVisible = true;
      this.PrintLoading = true;
      this.printsData = await axios.get("Print", {
        DocNo: this.DocNo,
        DocType: this.DocType
      });
      this.PrintLoading = false;
    },
    //还款单处理打印窗口
    getRefundHandlePrint() {
      this.RefundPrintHandleVisible = true;
    },
    //还款单流程打印窗口
    async getRefundPrint() {
      this.printsData = {
        entity: {
          BorrowLineSet: []
        }
      };
      this.RefundPrintVisible = true;
      this.PrintLoading = true;
      this.printsData = await axios.get("Print", {
        DocNo: this.DocNo,
        DocType: this.DocType
      });
      this.PrintLoading = false;
    },
    //借款单流程打印
    printBorrowPdf() {
      $("#formBorrow").jqprint({
        debug: false,
        importCSS: true,
        printContainer: false,
        operaSupport: false
      });
    },
    //还款单流程打印
    printRefundPdf() {
      $("#formRefund").jqprint({
        debug: false,
        importCSS: true,
        printContainer: false,
        operaSupport: false
      });
    },
    //报销单流程打印
    printExpensePdf() {
      $("#formExpense").jqprint({
        debug: false,
        importCSS: true,
        printContainer: false,
        operaSupport: false
      });
    },
    //借款单处理打印
    printBorrowPdf2() {
      $("#formBorrow2").jqprint({
        debug: false,
        importCSS: true,
        printContainer: false,
        operaSupport: false
      });
    },
    //还款单处理打印
    printRefundPdf2() {
      $("#formRefund2").jqprint({
        debug: false,
        importCSS: true,
        printContainer: false,
        operaSupport: false
      });
    },
    //报销单处理打印
    printExpensePdf2() {
      $("#formExpense2").jqprint({
        debug: false,
        importCSS: true,
        printContainer: false,
        operaSupport: false
      });
    },
    //供应商
    async getSupplier() {
      this.SupplierList = [];
      const res = await axios.get("getRcvOther")
      this.SupplierList = res;
      console.log(this.SupplierList,'this.SupplierList');
    },
    //供应商银行
    getSupplierBank() {
      axios
        .get("getSupplierBank", {
          Code: this.supplier, //供应商Code
          Type: 1 //对公
        })
        .then(res => {
         this.bankList = res;
         if(this.bankList.length==0 ||((!this.bankList[0].Bank) && 
          (!this.bankList[0].BankAccpunt) && 
          (!this.bankList[0].Code))){
            this.bank = '';
            this.bankAccount = '';
          }else{
            this.bank = res[0].Bank; //默认开户银行
            this.bankAccount = res[0].BankAccount; //默认银行卡
          }
        })
        .catch(err => {
          console.log(err);
        });
    },
    //改变供应商时候 重新获取银行接口
    choiceSupplie() {
      this.getSupplierBank();
    },
    //现金期间
    async getPeriod() {
      const res = await axios.get("getWorkPeriod",{type:0});
      this.PeriodList = res;
    },
    //现金流量类型
    async getCashFlow() {
      const res = await axios.get("getCashFlow");
      this.CashFlowList = res;
    },
    //获取对方科目
    async getAccountItem() {
      const res = await axios.get("getAccountItem")
      this.AccountItemList = res;
    },
    //获取辅助核算项目
    getAssistItem(cb, index) {
      axios
        .get("getAssistItem", {
          code: this.accountItem
        })
        .then(res => {
          if (res[0]) {
            this.$set(this.AssistItemList, index, res[0].data); //vue特定的改变数组的方式
            this.Name = res[0].AIT_Name;
          } else {
            this.$set(this.AssistItemList, index, []); //vue特定的改变数组的方式
          }
          cb && cb(); //如果回掉函数存在，就执行
        })
        .catch(err => {
          console.log(err);
        });
    },
    //改变对方科目时候
    changeAccountItem(index, e, event) {
      if (event) return; //如果下拉展开就不执行后面的了
      (this.Name = ""),
        (this.budgetList[index].assistItem = ""), //先清空辅助核算项目旧model数据
        (this.accountItem = e); //当前赋值改变的科目类型
      //cb是回掉函数，index是选中的行数
      this.getAssistItem(() => {
        let cache = Object.assign({}, this.budgetList[index]);
        cache.name = this.Name;
        this.$set(this.budgetList, index, cache);
        console.log(this.budgetList, "this.budgetList");
      }, index); //然后调用辅助核算项目
    },
    //付款单 提交
    addPaySubmit() {
      let myArr = [];
      //删除空行数据
      this.budgetList=this.budgetList.filter(item=>(item.Money||item.accountItem||item.assistItem));
      if (this.budgetList.length==0) {
        this.addBudgetlist();
      }
      let budgetList = this.budgetList;
      budgetList.forEach(value => {
        let money = value.Money;
        let accountItem = value.accountItem; //对方科目
        let assistItem = value.assistItem; //辅助核算项目
        let temp = `{"Money":${money},"Account":"${accountItem}","fzhs":"${assistItem}"}`;
        myArr.push(temp);
      });
      let Budget = myArr.join(","); //逗号分割并拼接备份给json字符串传参
      Budget = `[` + Budget + `]`;
      let params = {
        Pay_Supplier: this.supplier, //业务类型
        Pay_RcvBank: this.bank, //供应商
        Pay_DocDate: this.docDate, //日期
        Pay_CashFlowItem: this.cashFlow, //银行账号
        Pay_PayAccountItem: this.receivingType, //付款方式
        Pay_CashPeriod: this.period, //现金期间
        Pay_TotalPayMoney: this.applyMoney, //申请金额
        Pay_Title: this.describe, //描述
        Pay_RcvBankAccount: this.bankAccount, //银行卡
        key: null,
        Pay_DocStatus: 2, //提交类型 1.保存 2.提交
        Budget: Budget, //预算明细
        key: this.DocNo
      };
      axios.post("addPaySubmit", params).then(res => {
        if (res.Success == true) {
          this.$message({
            message: `提交成功`,
            type: "success",
            duration: 1200
          });
          this.isshowAddPay = false;
          this.isshowList = true;
          setTimeout(() => {
            this.$router.push({
              path: "/work"
            });
          }, 2000);
        } else {
          this.$message({
            message: res.Message,
            type: "warning",
            duration: 2000
          });
        }
      });
    },
    //新增付款单 保存
    addPaySave() {
      let myArr = [];
      //删除空行数据
      this.budgetList=this.budgetList.filter(item=>(item.Money||item.accountItem||item.assistItem));
      if (this.budgetList.length==0) {
        this.addBudgetlist();
      }
      let budgetList = this.budgetList;
      budgetList.forEach(value => {
        let money = value.Money;
        let accountItem = value.accountItem; //对方科目
        let assistItem = value.assistItem; //辅助核算项目
        let temp = `{"Money":${money},"Account":"${accountItem}","fzhs":"${assistItem}"}`;
        myArr.push(temp);
      });
      let Budget = myArr.join(","); //逗号分割并拼接备份给json字符串传参
      Budget = `[` + Budget + `]`;
      let params = {
        Pay_Supplier: this.supplier, //业务类型
        Pay_RcvBank: this.bank, //供应商
        Pay_DocDate: this.docDate, //日期
        Pay_CashFlowItem: this.cashFlow, //银行账号
        Pay_PayAccountItem: this.receivingType, //付款方式
        Pay_CashPeriod: this.period, //现金期间
        Pay_TotalPayMoney: this.applyMoney, //申请金额
        Pay_Title: this.describe, //描述
        Pay_RcvBankAccount: this.bankAccount, //银行卡
        key: null,
        Pay_DocStatus: 1, //提交类型 1.保存 2.提交
        Budget: Budget, //预算明细
        key: this.DocNo
      };
      axios.post("addPaySubmit", params).then(res => {
        if (res.Success == true) {
          this.$message({
            message: `保存成功`,
            type: "success",
            duration: 1200
          });
          if (res.data.DocNO) {
            this.DocNo = res.data.DocNO;
          }
        } else {
          this.$message({
            message: res.Message,
            type: "warning",
            duration: 2000
          });
        }
      });
    },
    //新增收款单 保存
    addRcvSave() {
      let printArr = [];
      let paymentsPrint = this.paymentsPrint;
      paymentsPrint.forEach(value => {
        let money = value.Money; //金额
        let id = value.Income_DocNo; //ID
        let temp = `{"je":${money},"ID":"${id}"}`;
        printArr.push(temp);
      });
      let sr = printArr.join(","); //逗号分割并拼接备份给json字符串传参
      sr = `[` + sr + `]`;

      let budgetArr = [];
      this.detail=this.detail.filter(item=>(item.IncomeMoney||item.Department||item.BudgetItem))
      if (this.detail.length==0) {
        this.addlist()
      }
      let detail = this.detail;
      detail.forEach(value => {
        let money = value.IncomeMoney; //金额
        let depart = value.Department; //部门
        let budget = value.BudgetItem; //收入类型
        let temp2 = `{"Money":${money},"Dept":"${depart}","Budget":"${budget}"}`;
        budgetArr.push(temp2);
      });
      let ysline = budgetArr.join(",");
      ysline = `[` + ysline + `]`;

      let params = {
        Rcv_DocDate: this.docDate, //日期
        Rcv_CashPeriod: this.period, //现金期间
        Rcv_PayCustomer: this.custom, //客户
        Rcv_RcvAccountItem: this.receivingType, //收款方式
        Rcv_TotalRcvMoney: this.CollectionMoney,
        Rcv_Title: this.describe, //描述
        key: null,
        Rcv_RcvType: this.isSwitch === false ? 0 : 2, //0=未勾上预收款  2=以勾上预收款
        SR: sr, //选择的收入确认单
        YSLine: ysline, //预收款添加的明细
        Rcv_DocStatus: 1, //1=保存  2=提交
        key: this.DocNo
      };
      axios
        .post("addWorkSubmit", params)
        .then(res => {
          if (res.Success == true) {
            this.$message({
              message: `保存成功`,
              type: "success",
              duration: 1200
            });
            if (res.data.DocNO) {
              this.DocNo = res.data.DocNO;
            }
          } else {
            this.$message({
              message: res.Message,
              type: "warning",
              duration: 2000
            });
          }
        })
        .catch(err => {
          console.log(err);
        });
    },
    //新增收款提交
    addRcvSubmit() {
      let printArr = [];
      let paymentsPrint = this.paymentsPrint;
      paymentsPrint.forEach(value => {
        let money = value.Money; //金额
        let id = value.Income_DocNo; //ID
        let temp = `{"je":${money},"ID":"${id}"}`;
        printArr.push(temp);
      });
      let sr = printArr.join(","); //逗号分割并拼接备份给json字符串传参
      sr = `[` + sr + `]`;

      let budgetArr = [];
      this.detail=this.detail.filter(item=>(item.IncomeMoney||item.Department||item.BudgetItem))
      if (this.detail.length==0) {
        this.addlist();
      }
      let detail = this.detail;
      detail.forEach(value => {
        let money = value.IncomeMoney; //金额
        let depart = value.Department; //部门
        let budget = value.BudgetItem; //收入类型
        let temp2 = `{"Money":${money},"Dept":"${depart}","Budget":"${budget}"}`;
        budgetArr.push(temp2);
      });
      let ysline = budgetArr.join(",");
      ysline = `[` + ysline + `]`;

      let params = {
        Rcv_DocDate: this.docDate, //日期
        Rcv_CashPeriod: this.period, //现金期间
        Rcv_PayCustomer: this.custom, //客户
        Rcv_RcvAccountItem: this.receivingType, //收款方式
        Rcv_TotalRcvMoney: this.CollectionMoney,
        Rcv_Title: this.describe, //描述
        key: null,
        Rcv_RcvType: this.isSwitch === false ? 0 : 2, //0=未勾上预收款  2=以勾上预收款
        SR: sr, //选择的收入确认单
        YSLine: ysline, //预收款添加的明细
        Rcv_DocStatus: 2, //1=保存  2=提交
        key: this.DocNo
      };
      axios
        .post("addWorkSubmit", params)
        .then(res => {
          if (res.Success == true) {
            this.$message({
              message: `提交成功`,
              type: "success",
              duration: 1200
            });
            this.isshowAddRcv = false;
            this.isshowList = true;
            setTimeout(() => {
              this.$router.push({
                path: "/work"
              });
            }, 2000);
          } else {
            this.$message({
              message: res.Message,
              type: "warning",
              duration: 2000
            });
          }
        })
        .catch(err => {
          console.log(err);
        });
    },
    // 新建返回到列表页面
    addToBack() {
      //点击退出，清空付款明细
      this.budgetList.length=0;
      this.addBudgetlist();


      this.isshowAddRcv = false; //新建页面隐藏
      this.isshowAddPay = false;
      this.isshowList = true; //列表页面显示
      this.getList();
      //返回，清空数组，合计Count1为0
      this.paymentsPrint=[]
       //返回，清空数组，合计Count2为0
      this.budgetList=[
        {
          Money: 0, //金额
          accountItem: "", //对方科目
          assistItem: "" //辅助核算项目
        }
      ]
    },
    addlist() {
      this.detail.push({
        IncomeMoney: "", //金额
        Department: "", //部门
        BudgetItem: "" //类型
      });
    },
    /**
     * 获得客户列表
     */
    /* getCustomer() {
      axios
        .get("getCustom")
        .then(res => {
          this.Customer = res;
        })
        .catch(err => {
          console.log(err);
        });
    }, */
    async remoteMethod(query) {
      if (query !== "") {
        this.loading = true;
        this.Customer = await axios.post("getCustomerQuery", {
          query
        });
        this.loading = false;
      } else {
        this.Customer = [];
      }
    },
    /**
     * 付款方式
     */
    async getReceivingType() {
      const res = await axios.get("getReceivingType");
      this.ReceivingTypeList = res;
    },
    //改变客户
    changeCustom(e) {
      console.log(e);
    },
    getPaymentAddDiaLog() {
      //如果还没选择客户的话 就给个提醒
      if (this.custom == null || this.custom == "" || this.custom.length == 0) {
        this.$message({
          message: "请先选择客户",
          type: "warning",
          duration: 1500
        });
        return;
      }
      if (this.paymentsPrint.length > 0) {
        // 取原列表数据
        const tempArr = JSON.parse(JSON.stringify(this.paymentsTemp)); //原数据
        // 将operaPrint 中金额不为0 的 数据对应 赋值给相应的
        for (let i = 0; i < tempArr.length; i++) {
          for (let t = 0; t < this.paymentsPrint.length; t++) {
            if (tempArr[i].ID == this.paymentsPrint[t].ID) {
              //如果循环的ID相同的话
              tempArr[i].Money = this.paymentsPrint[t].Money; //就赋值Money
            }
          }
        }
        this.paymentsTemp = tempArr; //operationTemp =>最终呈现在列表上的data
      } else {
        axios
          .get("getWorkIncome", {
            PayCustomer: this.custom, //客户编号
            Type: 0, //0是新建
            key: null //单据编号
          })
          .then(res => {
            this.paymentsTemp = res;
            this.paymentsTemp.forEach(item => {
              item.Income_TotalIncomeMoney =
                item.Income_TotalIncomeMoney === 0
                  ? ""
                  : item.Income_TotalIncomeMoney;
              item.Surplus = item.Surplus === 0 ? "" : item.Surplus;
              item.Money = item.Money === 0 ? "" : item.Money;
            });
          })
          .catch(err => {
            console.log(err);
          });
      }
      this.dialogPayVisible = true;
    },
    //确定按钮
    confirm() {
      //打印到备用数组上
      let myArr = []; //为了传参
      const tempArr = JSON.parse(JSON.stringify(this.paymentsTemp)); //paymentsTemp =>最终呈现在列表上的data
      this.paymentsPrint = [];
      tempArr.map(item => {
        //不为0的 才push上去
        item.Money = Number(item.Money).toFixed(2); //先转数字类型，再保留两位小数
        if (item.Money != 0.0 || item.Money != 0) {
          //如果不为0的 才push进去
          this.paymentsPrint.push(item);
        }
      });
      this.dialogPayVisible = false; //关闭弹窗
    },
    //取消
    cancel() {
      this.loading = true;
      this.isShowPrint = false;
      this.dialogRefundVisible = false;
      this.dialogBusinessVisible = false;
      this.dialogExpenseVisible = false;
      this.dialogPayVisible = false;
    },
    //确定按钮
    handlingDetermine() {
      if (this.DocType == 303) {
        //还款
        axios
          .get("handlingSubmit", {
            key: this.RefundMoneyObj.dt[0].Repay_DocNO,
            type: this.RefundMoneyObj.dt[0].Repay_DocType,
            DocDate: this.RefundMoneyObj.dt[0].Repay_DocDate,
            PayAccountItem: this.RefundMoneyObj.dt[0].Repay_RcvAccountItem,
            Time: this.RefundMoneyObj.dt[0].Repay_CashPeriod
          })
          .then(res => {
            if (res.Success == true) {
              this.isShowPrint = true;
              this.$message({
                message: res.Message,
                type: "success",
                duration: 1500
              });
              this.getList();
            } else {
              this.$message({
                message: res.Message,
                type: "warning",
                duration: 2000
              });
            }
          })
          .catch(err => {
            console.log(err);
          });
      } else if (this.DocType == 301) {
        //报销
        axios
          .get("handlingSubmit", {
            key: this.ExpenseObj.dt[0].Expense_DocNO,
            type: this.ExpenseObj.dt[0].Expense_DocType,
            DocDate: this.ExpenseObj.dt[0].Expense_DocDate,
            PayAccountItem: this.ExpenseObj.dt[0].Expense_PayAccountItem,
            Bank: this.ExpenseObj.dt[0].bank,
            BankAccount: this.ExpenseObj.dt[0].bankAccount,
            CashFlowItem: this.ExpenseObj.dt[0].Expense_CashFlowItem,
            Tite: this.ExpenseObj.dt[0].Expense_Title,
            Time: this.ExpenseObj.dt[0].Expense_CashPeriod
          })
          .then(res => {
            if (res.Success == true) {
              this.isShowPrint = true;
              this.$message({
                message: res.Message,
                type: "success",
                duration: 1500
              });
              this.getList();
            } else {
              this.$message({
                message: res.Message,
                type: "warning",
                duration: 2000
              });
            }
          })
          .catch(err => {
            console.log(err);
          });
      } else if (this.DocType == 302) {
        //借款
        axios
          .get("handlingSubmit", {
            key: this.BusinessObj.dt[0].Borrow_DocNO,
            type: this.BusinessObj.dt[0].Borrow_DocType,
            DocDate: this.BusinessObj.dt[0].Borrow_DocDate,
            PayAccountItem: this.BusinessObj.dt[0].Borrow_PayAccountItem,
            Bank: this.BusinessObj.dt[0].bank,
            BankAccount: this.BusinessObj.dt[0].bankAccount,
            CashFlowItem: this.BusinessObj.dt[0].Borrow_CashFlowItem,
            Tite: this.BusinessObj.dt[0].Borrow_Title,
            Time: this.BusinessObj.dt[0].Borrow_CashPeriod
          })
          .then(res => {
            if (res.Success == true) {
              this.isShowPrint = true;
              this.$message({
                message: res.Message,
                type: "success",
                duration: 1500
              });
              this.getList();
            } else {
              this.$message({
                message: res.Message,
                type: "warning",
                duration: 2000
              });
            }
          })
          .catch(err => {
            console.log(err);
          });
      }
    },
    //打开处理窗口
    // handling(index, row) {
    handling(...arr){
      let row=arr[0];
      this.DocType = row.Type;
      this.DocNo = row.DocNO;
      this.isShowPrint = false;
      let all = [
        axios.get("getReceivingType"), //收付款方式
        axios.get("getCashFlow"), //现金流量
        axios.get("getWorkPeriod", {
          type: 0
        }) //现金期间
      ];
      this.axios.all(all).then(
        this.axios.spread((res1, res2, res3) => {
          this.ReceivingTypeList = res1; //收付款方式
          this.CashFlowList = res2; //现金流量
          this.PeriodList = res3; //现金期间
        })
      );
      //还款单
      if (this.DocType == 303) {
        this.dialogRefundVisible = true;
        axios
          .get("getWorkRefundMoney", {
            key: this.DocNo,
            type: this.DocType
          })
          .then(res => {
            this.RefundMoneyObj = res;
            if (this.CashFlowList.length > 0) {
              this.RefundMoneyObj.dt[0].Repay_CashFlowItem = this.CashFlowList[0].CashFlowItem_Code; //现金流量
            }
          })
          .catch(err => {
            console.log(err);
          });
        //借款单
      } else if (this.DocType == 302) {
        this.dialogBusinessVisible = true;
        //获取借款单详细信息
        axios
          .get("getWorkBusiness", {
            key: this.DocNo,
            type: this.DocType
          })
          .then(res1 => {
            this.BusinessObj = res1;
            axios
              .get("getSupplierBank", {
                Code: this.BusinessObj.dt[0].Borrow_Supplier,
                Type: this.BusinessObj.dt[0].Borrow_BusinessType
              })
              .then(res2 => {
                this.bankList = res2;
                this.$set(this.BusinessObj.dt[0], "bank", "");
                this.$set(this.BusinessObj.dt[0], "bankAccount", "");
                this.BusinessObj.dt[0].bank = res2[0].Bank;
                this.BusinessObj.dt[0].bankAccount = res2[0].BankAccount;
              })
              .catch(err => {
                console.log(err);
              });
          })
          .catch(err => {
            console.log(err);
          });
      } else if (this.DocType == 301) {
        this.dialogExpenseVisible = true;
        //获取报销单详细信息
        axios
          .get("getWorkExpense", {
            key: this.DocNo,
            type: this.DocType
          })
          .then(res1 => {
            this.ExpenseObj = res1;
            axios
              .get("getSupplierBank", {
                Code: this.ExpenseObj.dt[0].Expense_Supplier,
                Type: this.ExpenseObj.dt[0].Expense_BusinessType
              })
              .then(res2 => {
                this.bankList = res2;
                this.$set(this.ExpenseObj.dt[0], "bank", "");
                this.$set(this.ExpenseObj.dt[0], "bankAccount", "");
                this.ExpenseObj.dt[0].bank = res2[0].Bank;
                this.ExpenseObj.dt[0].bankAccount = res2[0].BankAccount;
              })
              .catch(err => {
                console.log(err);
              });
          })
          .catch(err => {
            console.log(err);
          });
      }
    },
    //撤销到提交者修改
    revoToEdit(index, row) {
      this.$prompt("请输入您让单据提交者修改的内容：", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消"
      })
        .then(({ value }) => {
          this.$message({
            type: "success",
            message: "你输入的是: " + value
          });
          axios
            .get("revoToWork", {
              DocNo: row.DocNO,
              DocType: row.Type,
              News: value,
              Type: 1
            })
            .then(res => {
              if (res == "ok") {
                this.$message({
                  message: "撤销成功",
                  type: "success"
                });
                setTimeout(() => {
                  this.getList();
                }, 500);
              } else {
                this.$message({
                  type: "warning",
                  message: res
                });
                setTimeout(() => {
                  this.getList();
                }, 500);
              }
            })
            .catch(err => {
              console.log(err);
            });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "取消输入"
          });
        });
    },
    //撤销为新建
    revoToNews(index, row) {
      this.$prompt(
        "请输入您让单据提交者新建的内容（注：单据撤销后，单据状态为新建）",
        "提示",
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消"
        }
      )
        .then(({ value }) => {
          axios
            .get("revoToWork", {
              DocNo: row.DocNO,
              DocType: row.Type,
              News: null,
              Type: 2
            })
            .then(res => {
              this.$message({
                type: "success",
                message: "你输入的是: " + value,
                duration: 3000
              });
              if (res == "ok") {
                this.$message({
                  type: "success",
                  message: "撤销成功",
                  duration: 2000
                });
                setTimeout(() => {
                  this.getList();
                }, 2000);
              } else {
                this.$message({
                  type: "warning",
                  message: res
                });
                setTimeout(() => {
                  this.getList();
                }, 2000);
              }
            })
            .catch(err => {
              console.log(err);
            });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "取消输入"
          });
        });
    },
    preview(scoped) {
      console.log(this.$refs["images"]);
      if (this.viewer) {
        this.viewer.destroy();
      }
      this.viewer = new this.$Viewer(this.$refs["images"], {
        url: "src",
        toolbar: {
          zoomIn: {
            show: 4,
            size: "large"
          },
          zoomOut: {
            show: 4,
            size: "large"
          },
          prev: {
            show: 4,
            size: "large"
          },
          next: {
            show: 4,
            size: "large"
          },
          rotateLeft: {
            show: 4,
            size: "large"
          },
          rotateRight: {
            show: 4,
            size: "large"
          }
        }
      });
      console.log(this.$refs["images"].childNodes[scoped.$index]);
      this.$refs["images"].childNodes[scoped.$index].childNodes[0].click();
    },
    //打开附件列表窗口
    openUploadDialog() {
      this.dialogUploadVisible = true;
      this.getUploadList();
    },
    //判断是否显示预览按钮
    isShowPreview (name) {
      var fileType = ['gif','jpg','png','JPG','PNG'];
      var temp = name.substring(name.lastIndexOf('.')+1);
      if(fileType.indexOf(temp) > -1) {
        return true
      }else {
        return false
      }
    },
    //附件列表
    async getUploadList() {
      const res = await axios.get("UploadList",{key:this.DocNo,type:this.DocType,page:1,rows:5000})
      this.UploadList = res.rows;
    },
    //删除附件
    async DeleUpload(index, row) {
      const res = await axios.get("deleUpload",{key:row.ID})
      if(res.Success) {
        this.$message({
          message: res.Message,
          type: "success"
        });
        this.getUploadList();
      }else{
        this.$message({
          message: res.Message,
          type: "error"
        });
      }
    },
    //开始上传附件
    update(e) {
      for(var i=0 ;i < e.target.files.length;i++){
        let file = e.target.files[i];
        let param = new FormData(); //创建form对象
        param.append("fileData", file); //通过append向form对象添加数据
        param.append("chunk", "0"); //添加form表单中其他数据
        param.append("key", this.DocNo); //添加form表单中其他数据
        param.append("Type", this.DocType);
        console.log(param.get("file")); //FormData私有类对象，访问不到，可以通过get判断值是否传进去
        let config = {
          headers: {
            "Content-Type": "multipart/form-data"
          }
        }; //添加请求头
        axios
          .post("Upload", param, config)
          .then(response => {
            if (response.Success) {
              this.$message({
                message: `上传成功`,
                type: "success",
                duration: 800,
                
              });
            } else {
              this.$message({
                message: response.Message,
                type: "warning",
                duration: 2000
              });
            }
            this.getUploadList();
          }).catch(err => {
            console.log(err)
          });
      }
    }
  },
  mounted() {
    this.getList();
    this.getAccountItem(); //辅助核算项目
  },
  created() {
    this.getStart(); //获取状态
    //console.log(this.arraySum([1,2,3,5,6,7,81,112,4,455,6]),'总和');
  },
  computed: {
    Count1() {
      let sum = 0;
      for (let i of this.paymentsPrint) {
        sum += Number(i.Money);
      }
      return sum;
    },
    Count2() {
      let sum = 0;
      for (let i of this.budgetList) {
        sum += Number(i.Money);
      }
      return sum.toFixed(2);
    },
    Count3() {
      let sum = 0;
      for (let i of this.detail) {
        sum += Number(i.IncomeMoney);
      }
      return sum.toFixed(2);
    }
  }
};
</script>
<style scoped lang="scss">
@import "../../common/css/index.css";
.toolbar h2 {
  line-height: 36px;
  margin: 0 10px 0 0;
}

.wInput {
  width: 200px !important;
  margin-right: 40px;
}

.wSelect {
  width: 200px !important;
  margin-right: 40px;
}

.wDate {
  width: 200px !important;
  margin-right: 40px;
}

.titles {
  background: #d2d2d2;
  height: 24px;
  padding: 10px 0;
  border-radius: 4px;
  color: #000;
}

.rows {
  margin: 5px 0;
}

.left-form {
  line-height: 60px;
}

.left-form span.rvc {
  width: 80px;
  display: inline-block;
}

.left-form span.pay {
  width: 120px;
  display: inline-block;
}

.left-form .bankNum {
  width: initial;
  margin-left: 5px;
  top: 20px;
}

.rows .labels {
  width: 100px;
  display: inline-block;
}

.applied {
  margin-left: 0;
}

.el-input.is-disabled .el-input__inner {
  color: #000;
}
</style>
